Created
May 14, 2020 08:20
-
-
Save pditommaso/9558735e103354fdeb9c3b577b2d595a to your computer and use it in GitHub Desktop.
Bash snippet handling errors
This file contains 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
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