Skip to content

Instantly share code, notes, and snippets.

@downspot
Created February 11, 2018 19:10
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 downspot/f7bb804f2cc7d51265405da92ced2836 to your computer and use it in GitHub Desktop.
Save downspot/f7bb804f2cc7d51265405da92ced2836 to your computer and use it in GitHub Desktop.
runtest function
#!/bin/sh
email="email@example.com"
function runtest {
"$@"
local status=$?
if [ $status -ne 0 ]; then
echo "Script failed with error from '$@'" | mail -s "Script failure!" $email
exit 0
fi
return $status
}
runtest command
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment