Linux Commands - eval

by
Jeremy Canfield |
Updated: November 13 2020
| Linux Commands articles
The eval command can be used to run a command stored in a variable. For example, let's say you have the following variable.
[john.doe@server1 ~]$ cdtmp="cd /tmp"
The eval command can then be used to issue the command stored in the variable. Notice that when the eval command is issued, this actually changes the directory to /tmp.
[john.doe@server1 ~]$ eval $cdtmp
[john.doe@server1 tmp]$
Did you find this article helpful?
If so, consider buying me a coffee over at