From 30a42bd5c1087571ad49efe51d20a716737a9dec Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Mon, 17 Oct 2022 14:19:48 +0200 Subject: [PATCH] Improve build script options error reporting MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- build-image.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 ;; -- 2.34.1