In bash I\'m trying to collect my grep results in array, each cell holding each line. I\'m downloaing urls with this line
wget -O index -E $CurrentURL
Probably most elegant among several poor alternatives would be to use a temp file.
wget $blah | grep 'whatever' > $TMPFILE
declare -a arr
declare -i i=0
while read; do
arr[$i]="$REPLY"
((i = i + 1))
done < $TMPFILE
I don't have time to explain why, but do not pipe directly into read.
No Unix shell is an appropriate tool for this task. Perl, Groovy, Java, Python... lots of languages could handle this elegantly, but none of the Unix shells.