The following code when run as an individual command in shell script gives the expected result :
for x in This is good; do echo $x; done
[OUTPUT]
This
is
good
However when i pass it inside a string to Eval for some reason x is not being initialised
cmd = " for x in This is good; do echo $x ; done"
eval $cmd
[OUTPUT]
//Three blank lines
Why is x not being initialised ?