With "set -x"
In bash scripts, the -x flag turns on trace functionality. It can be turned on with "set -x" or with the -x option in the bash invocation like "bash -x myscript.sh" and even works in the shebang.
This next code snippit can be safely placed in your .bash_profile without any side effects (assuming vendor scripts don't contain debug code). It sets a prompt that you only see when the -x option is set in bash. It adds script line numbers and function names to the -x trace output.