Skip to content

Instantly share code, notes, and snippets.

@Romero027
Created Oct 3, 2020
Embed
What would you like to do?
Use DEBUG Trap to step through a bash script line by line - by Julia Evans
#!/bin/bash
# See https://jichu4n.com/posts/debug-trap-and-prompt_command-in-bash/ for a in-depth discussion
trap '(read -p "[$BASH_SOURCE:$LINENO] $BASH_COMMAND?")' DEBUG
var=2
echo $((var+2))
for i in 1 2 3 4 5
do
echo "Welcome $i times"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment