Skip to content

Instantly share code, notes, and snippets.

@tsibley
Created January 14, 2023 00:57
Show Gist options
  • Save tsibley/47c7694724fe86003a2ad778ebb585d9 to your computer and use it in GitHub Desktop.
Save tsibley/47c7694724fe86003a2ad778ebb585d9 to your computer and use it in GitHub Desktop.
# vim: set ft=sh :
__BASHDB_SOURCE="$BASH_SOURCE"
__bashdb:trap() {
local file="$1" line="$2" fn="$3" cmd="$4"
echo "→ $file:$line:$fn: $cmd" >&2
# From here we can return:
# 0 to continue
# 1 to skip cmd
# 2 to return from fn
# XXX example
if [[ "$file:$fn" == simple:f ]]; then
return 2
fi
return 0
}
trap '__bashdb:trap "$BASH_SOURCE" "$LINENO" "$FUNCNAME" "$BASH_COMMAND"' DEBUG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment