What can you do with the eval command? Why is it useful? Is it some kind of a built-in function in bash? There is no man page for it..
What is the eval command in bash?
bash;shell;eval
eval is part of POSIX. Its an interface which can be a shell built-in.Its described in the POSIX Programmer's Manual: http://www.unix.com/man-page/posix/1posix/eval/eval - construct command by concatenating argumentsIt will take an argument and construct a command of it, which will be executed by the shell. This is the example of the manpage:1) foo=10 x=foo2) y='$'$x3) echo $y4) $foo5) eval y='$'$x6) echo $y7) 10In the first line you define $foo with the value '10' and $x with the value 'foo'. Now define $y, which consists of the string '$foo'. The dollar sign must be escapedwith '$'. To check the result, echo $y.The result will be the string '$foo'Now we repeat the assignment with eval. It will first evaluate $x to the string 'foo'. Now we have the statement y=$foo which will get evaluated to y=10.The result of echo $y is now the value '10'.This is a common function in many languages, e.g. Perl and JavaScript.Have a look at perldoc eval for more examples: http://perldoc.perl.org/functions/eval.html