My answer to your (fairly pointless, IMO
) poll is "could be better". I believe I understand basically what you want, but it needs more detail to make it really clear. What kind of "command" output are you talking about? Is it something simple like "find", or is it the output of a complex scripting function? Explaining exactly what you're trying to do is the most direct way to get help.
In any case, whether the input is space-separated or line-separated shouldn't matter generally, because the IFS defaults to both. I'm not an expert on arrays, but if, for example, you want to input the files in the current directory, you could do something like this:
Code:
find .
./afile.txt
./bfile.txt
./cfile.txt
testarray=( $(find .) )
echo ${testarry[@]}
./afile.txt ./bfile.txt ./cfile.txt
Another way could be to use a loop. Assuming $(command) gives your output:
Code:
N=0
for i in $(command) ; do
testarray[$N]="$i"
echo "$N = $i" #to confirm the entry
let "N= $N + 1"
done