Skip to content

Instantly share code, notes, and snippets.

@np
Last active October 10, 2015 19:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save np/3736727 to your computer and use it in GitHub Desktop.
Save np/3736727 to your computer and use it in GitHub Desktop.
Simple 'error' function in shell
# error() @ https://gist.github.com/np/3736727#file-error-sh {{{
# Takes an exit code and a message, prints the message and then exits
error(){
local code="$1"
shift
echo "error: $@" >>/dev/stderr
exit "$code"
}
# }}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment