In a bash script how do I echo all shell commands called and expand any variable names? For example, given the following line:
ls $DIRNAME
I would like the script to run the command and display the following
ls /full/path/to/some/dir
The purpose is to save a log of all shell commands called and their arguments. Perhaps there is a better way of generating such a a log?