In a shell script: echo shell commands as they are executed -


How do I resize all shell commands in a shell script and expand any variable names? For example, the following line was given:

  ls $ DIRNAME  

I would like to run the command command and display the following

< The purpose of this is to save the name and the names of all shell commands and their arguments. Perhaps there is a better way to create such an ebb?

set-x or set-o extras Expands variables and prints a little + sign before the line.

set -v or set -o verbose does not extend the variable before printing.

Use set + x and set + v to close the above settings.

On the first line of the script, any #! / Bin / sh -x can later have the same effect as set -x script.

The above also works with / bin / sh .

  $ cat shl #! / Bin / Bash DIR = / tmp / so LS $ DIR $ bash -x shl + DIR = / tmp / so + ls / tmp / so $  

Comments