Skip to content

Instantly share code, notes, and snippets.

@pditommaso
Created May 14, 2020 08:20
Show Gist options
  • Save pditommaso/9558735e103354fdeb9c3b577b2d595a to your computer and use it in GitHub Desktop.
Save pditommaso/9558735e103354fdeb9c3b577b2d595a to your computer and use it in GitHub Desktop.
Bash snippet handling errors
set +e
trap 'catch' ERR
catch() {
echo "An error has occurred but we're going to eat it!! exit status $?"
}
echo "Before bad command"
badcommand
echo "After bad command"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment