In a bash script echo shell commands

Posted by user343547 on Stack Overflow See other posts from Stack Overflow or by user343547
Published on 2010-05-18T00:03:09Z Indexed on 2010/05/18 0:10 UTC
Read the original article Hit count: 428

Filed under:
|

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?

© Stack Overflow or respective owner

Related posts about bash

Related posts about shell-scripting