From 0722b25c03f630086e355dfd639999ea9a61f5d8 Mon Sep 17 00:00:00 2001 From: onovy Date: Sun, 29 Mar 2015 17:57:06 +0200 Subject: [PATCH] Check scripts params. --- osync-batch.sh | 6 +++++- osync.sh | 9 +++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/osync-batch.sh b/osync-batch.sh index bc9c6de..b127db9 100755 --- a/osync-batch.sh +++ b/osync-batch.sh @@ -104,6 +104,7 @@ function Usage echo "--dry Will run osync without actually doing anything; just testing" echo "--silent Will run osync without any output to stdout, used for cron jobs" echo "--verbose Increases output" + exit 128 } silent=0 @@ -136,7 +137,10 @@ do ;; --help|-h) Usage - exit 0 + ;; + *) + Log "Unknown param '$i'" + Usage ;; esac done diff --git a/osync.sh b/osync.sh index d5a8e73..15f8372 100755 --- a/osync.sh +++ b/osync.sh @@ -2040,6 +2040,7 @@ then Usage fi +first=1 for i in "$@" do case $i in @@ -2100,7 +2101,15 @@ do --no-locks) nolocks=1 ;; + *) + if [ $first == "0" ] + then + LogError "Unknown option '$i'" + Usage + fi + ;; esac + first=0 done # Remove leading space if there is one