bash -x

Tracing mode, turned on with bash -x or set -x, in which bash prints each command after expansion, just before running it.

In more detail

Each trace line starts with a plus sign, one per level of nesting, and shows the real values the command received, which exposes typos and bad quoting. Wrap only the suspect part in set -x and set +x to keep the output short. Trace output goes to standard error.

Example

bash -x script.sh

Related terms

Taught in

References