I wanted to read output of a command in an array:
Something like:
(reformatted for code using {} above the input box)
var=`echo tell told till`
echo "$var" | while read temp; do echo $temp ; done
This program will output:
tell
told
till
I had two questions:
- Read command reads from stdin. But in the above case how is it reading? echo puts the values on stdout.
- I wanted to know how to put those elements in an array? Basically how to put elements in stdout in an array. Read -a command can put the elements in stdin, but i wanted stdout.