From 85fecdbd2944c674cb72dc68c69f6ae98fd12cc9 Mon Sep 17 00:00:00 2001 From: Price Hiller Date: Mon, 4 Oct 2021 21:43:58 -0500 Subject: [PATCH] Exit with an error code if an unknown option is passed --- Templates/Functions/Arg-Parsing.bash | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Templates/Functions/Arg-Parsing.bash b/Templates/Functions/Arg-Parsing.bash index 0728a04..454a04e 100755 --- a/Templates/Functions/Arg-Parsing.bash +++ b/Templates/Functions/Arg-Parsing.bash @@ -56,6 +56,7 @@ parse_args() { -?*) printf 'Unknown option: %s\n' "$1" >&2 usage + exit 1 ;; *) # Default case: No more options, so break out of the loop. break ;; @@ -64,4 +65,4 @@ parse_args() { done } -parse_args "$@" \ No newline at end of file +parse_args "$@"