From 308f7394676c064c505a2bca0f504f8c4d5f5bc2 Mon Sep 17 00:00:00 2001 From: Kristaps Kaupe Date: Wed, 16 Mar 2022 01:06:27 +0200 Subject: [PATCH] Print which option is invalid in shell scripts --- install.sh | 3 +++ test/run_tests.sh | 3 +++ 2 files changed, 6 insertions(+) diff --git a/install.sh b/install.sh index 002a3cb..96cb7e0 100755 --- a/install.sh +++ b/install.sh @@ -393,6 +393,9 @@ parse_flags () break ;; *) + if [[ $1 != '-h' ]] && [[ $1 != '--help' ]]; then + echo "Invalid option $1" + fi echo " Usage: "${0}" [options] diff --git a/test/run_tests.sh b/test/run_tests.sh index 504eb79..4ab8f72 100755 --- a/test/run_tests.sh +++ b/test/run_tests.sh @@ -122,6 +122,9 @@ parse_flags () break ;; *) + if [[ $1 != '-h' ]] && [[ $1 != '--help' ]]; then + echo "Invalid option $1" + fi echo " Usage: "${0}" [options]