What can a man do with the "eval" command, why is it usefull? It's some kind of built-in function in bash? There is no "man" page for it..
Its described in the "POSIX Programmer's Manual": http://www.unix.com/man-page/posix/1posix/eval/
It will take an argument and construct a command of it, which will be executed by the shell. This is the example of the manpage:
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 |
|||||||||
|
Yes,
Usually it is used in combination with a Command Substitution. Without an explicit Note the difference:
Last but not least, |
||||
|
In addition, the output if
|
|||||
|
The eval statement tells the shell to take eval’s arguments as command and run them through the command-line. It is useful in a situation like below: In your script if you are defining a command into a variable and later on you want to use that command then you should use eval:
|
|||
|
type command
to learn of what type a command is. (type eval
in ths case) – rozcietrzewiacz Oct 22 '11 at 20:38