If I do gshuf -e $(seq 1 10) in bash it will print the numbers 1 thru 10 in random order. But if I do: a=$(shuf -e $(seq 1 10))for i in ${a[@]}do    echo $i    echo nextdoneIt prints all ten numbers followed by next.How do I loop over the output from shuf (or gshuf in os x)? The variable, a,  seems to be a string, so I could split it. But that seems sort of sloppy. How do I get shuf to output an array?
How do I loop over output from shuf?
bash;shell script
You are using a scalar assignment. Either use an arraya=( $(shuf -e $(seq 1 10)) )for i in ${a[@]}do    echo $i    echo nextdoneor let the shell split the scalara=$(shuf -e $(seq 1 10))for i in ${a}do    echo $i    echo nextdone