From 085b260a7b490c074f3c6dee846c60f83459a0ea Mon Sep 17 00:00:00 2001 From: Paul Morgan Date: Fri, 4 Sep 2015 19:34:00 -0400 Subject: [PATCH] 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 --- docker-bench-security.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docker-bench-security.sh b/docker-bench-security.sh index 6547c23..fd1be3f 100755 --- a/docker-bench-security.sh +++ b/docker-bench-security.sh @@ -41,7 +41,6 @@ usage () { -h optional Print this help message -l PATH optional Log output in PATH EOF - exit 1 } yell "# ------------------------------------------------------------------------------ @@ -69,9 +68,9 @@ fi while getopts hl: args do case $args in - h) usage ;; + h) usage; exit 0 ;; l) logger="$OPTARG" ;; - *) usage ;; + *) usage; exit 1 ;; esac done