Skip to content

Instantly share code, notes, and snippets.

@eesa1980
Created May 25, 2022 13:21
Show Gist options
  • Save eesa1980/2853c2a62bf2186ac4e443a3cb4181d9 to your computer and use it in GitHub Desktop.
Save eesa1980/2853c2a62bf2186ac4e443a3cb4181d9 to your computer and use it in GitHub Desktop.
Exit bash script on failure #bash #script
set -e
trap 'last_command=$current_command; current_command=$BASH_COMMAND' DEBUG
trap 'echo "\"${last_command}\" Error: pipeline failed with exit code $?."' EXIT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment