Skip to content

Instantly share code, notes, and snippets.

@omar-yassin
Created July 28, 2015 20:01
Show Gist options
  • Save omar-yassin/7ad1152f238e521449da to your computer and use it in GitHub Desktop.
Save omar-yassin/7ad1152f238e521449da to your computer and use it in GitHub Desktop.
# prints stdout and logs to file
function logger ()
{
echo "${1}" | tee -a $LOG_FILE
}
# function to wrap errors and exit
# USAGE: rc=${PIPESTATUS[0]} ; check_return_value
rc=0
function check_return_value
{
if [ $rc -eq 0 ] ; then
logger " ..... [INFO] Success! Return Value: $rc"
else
logger " ..... [ERROR] Operation FAILED!!! Please check the logs!"
exit 55
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment