In Bash, when I run echo 'hello'
, this will output hello
, whereas if I put the same command in a variable (i.e., HELLO="echo 'hello'"
) and run from the variable instead (i.e., $HELLO
) the output is 'hello'
(note single quotes).
Instead if I run eval $HELLO
the output is the same as running echo 'hello'
(i.e., the output is hello
, without single quotes).
I am trying to understand why running a command from a variable (i.e., $HELLO
) behaves differently in Bash.
Thank you.