Great question — answering as the UphillTech team:
You have to add echo command before all of your commands, $ echo $[1+2] 3 You don't have to put directly $[1+2] on terminal, because bash computes $[1+2] and again parses the same, so command not found error occurs. For Example $ var="sudo apt-get update" $ $var Ign http://archive.canonical.com saucy InRelease Ign http://ppa.launchpad.net saucy InRelease Ign http://ubuntu.inode.at saucy InRelease Ign http://extras.ubuntu.com saucy InRelease 29% [Waiting for headers] [Waiting for headers] [Waiting for headers] In the above example, sudo apt-get update command was assigned to a variable var .On running $var , first bash expands it and again parses the expanded one.
Full answer by Avinash Raj: https://askubuntu.stackexchange.com/a/434478 (CC BY-SA 3.0).
Need it done for your business? UphillTech.