Skip to content

Instantly share code, notes, and snippets.

@larry-fuy
Created October 8, 2014 20:53
Show Gist options
  • Save larry-fuy/ccd35c8ded2635507563 to your computer and use it in GitHub Desktop.
Save larry-fuy/ccd35c8ded2635507563 to your computer and use it in GitHub Desktop.
Bash output error message and exit
#!/bin/sh
# http://stackoverflow.com/questions/12700507/bash-proper-way-of-printing-out-an-error-message
error() {
echo "$@" 1>&2
}
fail() {
error "$@"
exit 1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment