exit with proper status on CLI options

* if `-h` is used: exit good
* if a non-valid CLI option is used without `-h`: exit bad

Signed-off-by: Paul Morgan <jumanjiman@gmail.com>
This commit is contained in:
Paul Morgan 2015-09-04 19:34:00 -04:00
parent aaffcb8df1
commit 085b260a7b

View file

@ -41,7 +41,6 @@ usage () {
-h optional Print this help message -h optional Print this help message
-l PATH optional Log output in PATH -l PATH optional Log output in PATH
EOF EOF
exit 1
} }
yell "# ------------------------------------------------------------------------------ yell "# ------------------------------------------------------------------------------
@ -69,9 +68,9 @@ fi
while getopts hl: args while getopts hl: args
do do
case $args in case $args in
h) usage ;; h) usage; exit 0 ;;
l) logger="$OPTARG" ;; l) logger="$OPTARG" ;;
*) usage ;; *) usage; exit 1 ;;
esac esac
done done