From c828412056e3b83f8616e336962ee79a4056b58a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonin=20D=C3=A9cimo?= Date: Fri, 8 Nov 2013 18:04:37 +0100 Subject: [PATCH] Script will now stop if there are errors in the options --- love-release.sh | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/love-release.sh b/love-release.sh index 13be7c4..daef24a 100755 --- a/love-release.sh +++ b/love-release.sh @@ -73,8 +73,9 @@ function getoptex() if [ -z "$OPTARG" ]; then # error: must have an agrument let OPTERR && echo "$0: error: $OPTOPT must have an argument" >&2 - OPTARG="$OPTOPT"; - OPTOPT="?" + exit + # OPTARG="$OPTOPT"; + # OPTOPT="?" return 1; fi OPTIND=$[OPTIND+1] # skip option's argument @@ -84,8 +85,9 @@ function getoptex() if [ "$opttype" = ";" ]; then # error: must not have arguments let OPTERR && echo "$0: error: $OPTOPT must not have arguments" >&2 - OPTARG="$OPTOPT" - OPTOPT="?" + exit + # OPTARG="$OPTOPT" + # OPTOPT="?" return 1 fi OPTARG=${o#"--$OPTOPT="} @@ -101,8 +103,9 @@ function getoptex() if [ -z "$OPTARG" ] then echo "$0: error: -$OPTOPT must have an argument" >&2 - OPTARG="$OPTOPT" - OPTOPT="?" + exit + # OPTARG="$OPTOPT" + # OPTOPT="?" return 1 fi OPTIND=$[OPTIND+1] # skip option's argument @@ -124,6 +127,7 @@ function getoptex() fi done echo "$0: error: invalid option: $o" + exit fi; fi OPTOPT="?" unset OPTARG