Skip to content

Instantly share code, notes, and snippets.

@maasha
Created January 31, 2013 16:16
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 maasha/4684011 to your computer and use it in GitHub Desktop.
Save maasha/4684011 to your computer and use it in GitHub Desktop.
# Function to run a command and handle errors.
function run()
{
local cmd=$@
log "INIT" $cmd
if error=$($cmd); then
log "OK" $cmd
echo_green "OK"
else
log "FAIL" $cmd
echo_red "FAIL"
echo " $error"
exit_abort
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment