The eval command will evaluate the command line to complete any shell substitutions and will then execute it. Eval is used to expand variables where one pass of the expansion does not do the job; eval makes two passes through a variable to expand it. Variables that require two passes to evaluate are sometimes called complex variables. Take it from me, variables are not complex.
Eval can still be used to echo out simple variables; they do not have to be complex variables.
$ NAME=Honeysuckle $ eval echo $NAME Honeysuckle $ echo $NAME Honeysuckle
The best way to explain how eval works is to see it on the command line as it evaluates.
Let’s first create a little file called testf that holds ...