On , I learnt ...

About Bash’s DEBUG signal

Bash has a DEBUG signal that you can register a handler for using trap.

You can use this to print a prompt before each command is executed, which allows you to step through a Bash script:

trap '(read -p "[$BASH_SOURCE:$LINENO] $BASH_COMMAND ")' DEBUG

Source: