On Tue, Jan 26, 2010 at 1:27 PM, Gerard <ger...@seibercom.net> wrote: > This is probably a dumb question; however, I have a question > regarding 'eval'.
> eval foo -a -b eval will execute foo -a -b. > eval $(foo -a -b) foo -a -b will run before eval is executed, the output of foo will replace the $( ). ie if foo -a -b prints "echo hello" then the command executed will be "eval echo hello" which execute echo hello, and it will print hello the difference with or without eval is that the expansion are done 2 times: var=foo foo=bar;echo '$'$var after the expansion $var is replace by it's value and the command executed: echo '$'foo which prints '$foo' var=foo foo=bar;eval echo '$'$var after the expansion $var is replace by it's value and the command executed: eval echo $foo eval will do the expansion quote removal a second time and the command executed by eval will be: echo bar which prints "bar"