Philip Rowlands
Fri, 18 Sep 2009 07:01:21 -0700
On Fri, 18 Sep 2009, Eric Blake wrote:
However, it seems to me that your problem is that bash tries to slurp all of $() into memory, and seq generated so much data that bash ran out of memory (or overflowed its stack).
It's certainly possible for bash to run out of stack and crash with SIGSEGV.
$ bash -c 'recurse() { recurse; }; recurse'
Segmentation fault
for i in $(seq -w $NUM1 $NUM2); do wget "$URL${i}$EXT"; done
This could be rewritten as
seq -w $NUM1 $NUM2 | while read i ; do wget "$URL${i}$EXT"; done
to prevent all of seq's output having to be buffered at once.
Cheers,
Phil