Short: use eval "$hello".
(This answer originally said: use eval $hello
but another poster pointed out that eval "$hello" is safer.)
As shown below:
bash-2.05a$ export hello='for i in 0 1 2 3; do echo $i; done'
Simply saying $hello at the beginning of a line does not work - because for loops are processed before $variable expansion (phase oriented languages, I hate 'em):
bash-2.05a$ $hello
bash: for: command not found
But eval'ing works:
bash-2.05a$ eval $hello
0
1
2
3
bash-2.05a$
What you were (or might have been) doing wrong:
bash-2.05a$ export hello='for i in {0..4}; do echo $i; done'
bash-2.05a$ $hello
bash: for: command not found
bash-2.05a$ eval $hello
{0..4}
bash-2.05a$ for i in {0..4}; do echo $i; done
{0..4}
bash-2.05a$
I.e. at least in the version of bash I am using, {0..4} doesn't do what you thought it should.
http://www.cyberciti.biz/faq/bash-for-loop/ says that the {0..4} feature came in bash 3.0+.
Perhaps you, like me (at woprk, not home), are using an obsolete version of bash?
echo $STYshould print out the actual textfor i in {0..3}; do echo $i; done? Or are you saying thatecho $STYshould execute that for-loop? (I ask because, although it sounds to me like the former, Borealid below seems to think you really want the latter.)eval $hello