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:
TIL that you can use the "DEBUG" trap to step through a bash script line by line pic.twitter.com/JBckrcr06G
— 🔎Julia Evans🔍 (@b0rk) October 3, 2020