Debugging bash scripts

Jacob Allred
#linux

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.