Created
October 1, 2020 16:59
-
-
Save wwalker/95163c9fdfc624526ba32b8e38584534 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# debug-script a script/run script while gathering debug info | |
ds(){ | |
local cmd | |
local PS4 | |
local basename | |
basename=${1%%*/} | |
cmd=$(command -v "$1") | |
shift | |
PS4='+ ($?) ($LINENO) ' | |
PS4="$PS4" bash -x "$cmd" "$@" |& tee ~/logs/"$basename-$(date +%FT%T)" | grep -v "^${PS4:0:1}" | |
} | |
# debug-it used to debug a function | |
di(){ | |
set -x | |
"$@" | |
set +x | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment