Skip to content

Instantly share code, notes, and snippets.

@coderofsalvation
Created January 8, 2014 21:03
Show Gist options
  • Save coderofsalvation/8324629 to your computer and use it in GitHub Desktop.
Save coderofsalvation/8324629 to your computer and use it in GitHub Desktop.
print a stacktrace with a msg, exits with 1
# print a stacktrace with a msg, exits with 1
function stacktrace()
{
if [ -n "$BASH" ]; then
_die_var_frame=0
while caller $_die_var_frame; do
_die_var_frame=$(expr $_die_var_frame + 1);
done
fi
printf "%s\\n" "$*"
exit
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment