Exit with an error code if an unknown option is passed

This commit is contained in:
Price Hiller 2021-10-04 21:43:58 -05:00
parent 379d411cfd
commit 85fecdbd29

View File

@ -56,6 +56,7 @@ parse_args() {
-?*) -?*)
printf 'Unknown option: %s\n' "$1" >&2 printf 'Unknown option: %s\n' "$1" >&2
usage usage
exit 1
;; ;;
*) # Default case: No more options, so break out of the loop. *) # Default case: No more options, so break out of the loop.
break ;; break ;;
@ -64,4 +65,4 @@ parse_args() {
done done
} }
parse_args "$@" parse_args "$@"