Normally your shell goes through an evaluation step to substitute variables ($var) with their actual contents.
command forces an extra evaluation step. Take the 3 echo's below:
eval echo "\$hello_$var"
The first echo will be evaluated as if $hello_
are 2 separate variables, because they both start with a $-sign. so the echo will evaluate to nothing, because $hello_
isn't defined anywhere, and to 'guys', because that's what $var
is filled with.
If you escape the $-sign before 'hello', the evaluation will just print the $-sign. Therefor 'hello' is no variable anymore and thus the string hello_
is printed. $var
isn't excaped, so the eval step will substitute it with it's contents guys
. This results in the string $hello_guys
But you want the contents
so you have to force another eval step.
ps: I didn't know you are into guys, 'doll'. Unfortunately, I'm not.