Debugging bash scripts

I use a lot of bash scripts to automate my server tasks. They are quick and easy to write, and work across multiple distributions with little to no modification.

Debugging bash scripts is easy. If your bash script is named awesome_script, then you would do something like this:

bash -x awesome_script

In addition to running the script, it will output every command the script runs along with the result of that command. No modifications to your script are needed.

Leave a Reply

Your email address will not be published. Required fields are marked *