Created
October 8, 2014 20:53
-
-
Save larry-fuy/ccd35c8ded2635507563 to your computer and use it in GitHub Desktop.
Bash output error message and exit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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