From 7346b37a0d7a888ae4315540450c2daf6dba17bd Mon Sep 17 00:00:00 2001 From: "Dominik D. Geyer" Date: Mon, 3 Dec 2012 00:20:49 +0100 Subject: [PATCH] Test for number of script arguments to be 1 after shifting options --- gitwatch.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gitwatch.sh b/gitwatch.sh index 9810230..0f59cd5 100755 --- a/gitwatch.sh +++ b/gitwatch.sh @@ -46,11 +46,6 @@ shelp () { # Print a message about how to use this script echo "is specified." } -if [ -z $1 ]; then - shelp - exit -fi - while getopts b:hp: option do case "${option}" in @@ -62,6 +57,11 @@ done shift $((OPTIND-1)) # Shift the input arguments, so that the input file (last arg) is $1 in the code below +if [ $# -ne 1 ]; then + shelp + exit +fi + # Check for both git and inotifywait and generate an error # if either don't exist or you cannot run them