[Android] [PATCH 1/5] compile.sh: error on invalid usage

Filip Roséen filip at atch.se
Tue Aug 9 04:01:47 CEST 2016


If a user of the script happens to pass an invalid option to
"compile.sh" we should not ignore it, instead it is more appropriate
to add a diagnostic saying that the user has supplied an invalid
option.

As such, these changes adds a fallback entry to the argument parsing
so that the script aborts to save user from unexpected behavior.
---
 compile.sh | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/compile.sh b/compile.sh
index 650b27e..3e92ae3 100755
--- a/compile.sh
+++ b/compile.sh
@@ -43,6 +43,11 @@ while [ $# -gt 0 ]; do
         run)
             RUN=1
             ;;
+        *)
+            echo "$0: Invalid option '$1'." 1>&2
+            echo "$0: Try --help for more information." 1>&2
+            exit 1
+            ;;
     esac
     shift
 done
-- 
2.9.2



More information about the Android mailing list