Why can't I do this?
eval "TEST=5;echo $TEST;";
THIS WORKS!!
TEST=5;echo $TEST;
Why can't I do this?
eval "TEST=5;echo $TEST;";
THIS WORKS!!
TEST=5;echo $TEST;
I figured it out I have to escape \$
It also appears I have to escape backticks (`)
Why is this?
eval tells the shell to take the parameters and interpret them as if they had just been typed on the command line. So take:
eval echo $TEST
the shell first interprolates the variables as normal, so eval sees:
eval echo 5
and so executes:
echo 5