From: Jérôme Benoit Date: Mon, 17 Oct 2022 12:19:48 +0000 (+0200) Subject: Improve build script options error reporting X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=30a42bd5c1087571ad49efe51d20a716737a9dec;p=mbt-docker.git Improve build script options error reporting Signed-off-by: Jérôme Benoit --- diff --git a/build-image.sh b/build-image.sh index d18125a..14efb6a 100755 --- a/build-image.sh +++ b/build-image.sh @@ -22,10 +22,20 @@ while getopts "n:h" option; do elif [[ -z "${images##*$name*}" ]]; then make NAME=${name} else + echo "Error: Unknown image name for option argument -${OPTARG}" >&2; usage exit 1 fi ;; + \?) + # Invalid option + echo "Error: Unknown or invalid option argument for -${OPTARG}" >&2; + usage + exit 1;; + :) + echo "Error: Missing option argument for -${OPTARG}" >&2; + usage + exit 1;; *|h) usage ;;