Created
August 21, 2018 17:37
-
-
Save alexfinnarn/480d46aa9367f4e231ea9aa0fc68e142 to your computer and use it in GitHub Desktop.
earlyexit helper function
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
# This function takes the output of the last command and exits if it failed. | |
earlyexit() { | |
CODE="$?" | |
if [ "${CODE}" != "0" ]; then | |
echo --- | |
echo Exiting on failure... | |
echo --- | |
exit 1 | |
fi | |
echo Script succeeded. | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment