How to print out every commands in a bash script during execution

Printing out every commands in a bash script during execution will be helpful in debugging purposes.

We can use the following command to print out every commands in a bash script during execution.

#bash -x script-file

Here we need to replace script-file with the name of the script.

The same option can be configured inside the script file itself. In that case the script need to be updated with the following line.

set -x

That's all…

Leave a Reply