Below I have an example which confuses me a bit, any help would be appreciated.
I bind a normal command line command (ls) to a new variable. If I echo it it the output is just the command (ls) but if I just use the variable without echo i get the result of the command but why?? Is it because $listdir gets translated to ls so I just get the output? And if I use the echo command it will be interpreted as a string?
router@test:~/scripting$ listdir=ls
router@test:~/scripting$ echo "$listdir"
ls
----- VS ----
router@test:~/scripting$ $listdir
basicLoop.sh fileflood.sh .......
Thank you for any help!
$listdirgets expanded, and the first word (lshere, which is also the only word for this case) of the expansion is interpreted as a command, and subsequent words, if any, as arguments.