Skip to content

Instantly share code, notes, and snippets.

@alloydwhitlock
Last active January 3, 2016 01:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alloydwhitlock/8390969 to your computer and use it in GitHub Desktop.
Save alloydwhitlock/8390969 to your computer and use it in GitHub Desktop.
Fail Detection
#!/bin/bash
#
#Name: Fail Detection
#Function: If the previously executed command fails the script will exit.
function failDetect () {
if [ $? -eq 0 ]; then
echo -e "Something went horribly wrong... exiting script."
exit 2
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment