eval command in Linux with Examples

eval is a built-in Linux command which is used to execute arguments as a shell command. It combines arguments into a single string and uses it as an input to the shell and execute the commands.

Syntax

eval [arg ...]

Example: In the below figure, you can see that cd Desktop command is stored in a variable “CD” as a shell command. Now you can use this “CD” as an argument with eval command.



Options:

  • help : It displays help information.



My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.