Debugging Scripts: bash -x

bash -x runs a script and prints every line before it runs, with its variables already filled in, so you can watch what the script really did; set -x and set +x trace one part only, and PS4 adds line numbers to the trace.

Updated

Cheat sheet for the lesson Debugging Scripts: bash -x: bash -x runs a script and prints every line before it runs, with its variables already filled in, so you can watch what the script really did; set -x and set +x trace one part only, and PS4 adds line numbers to the trace.
Category
Bash
Level
Journeyman
Tags
execution-trace, linux, ps4, shell-script, standard-streams, unix