As a complete newbie to bash, I've got the following script:FOOS=foo{1..5}for i in `echo $FOOS` doecho bardoneNow I (think I) get the idea that the brace expansion only works with literals - hence the echo - but all this seems to do is print just one bar to the console. Why (is string/brace expansion not working)?What I'd expect to happen is:Assign the string (foo{1..5}) representing an expansion to variable FOOSsubstitute $FOOS, so I've basically got    for i in 'echo foo{1..5}' do (looks like I can't escape back-ticks here)execute echo, so I now have for i in foo1 foo2 foo3 foo4 foo5 doexecute for, printing bar five times to the console outputNot get just one bar printed on screen as the only output :-)
Expanding a brace expansion string held in a variable for use in a for loop?
bash;string;brace expansion
1.FOO=$(echo foo{1..5})but better is to use an arrayFOO=(foo{1..5})2.echo ${FOO[*]}4.for i in {1..5}do    echo bardoneorfor i in $(seq 5)do    echo bardone