From ebd42d06b18ad6883be7b5bd3ea1390db47bda94 Mon Sep 17 00:00:00 2001 From: Username404-59 Date: Sun, 28 Feb 2021 13:59:05 +0100 Subject: [PATCH] Show the usage only one time in ybcon.sh, in all possible cases. --- scripts/ybcon.sh | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/scripts/ybcon.sh b/scripts/ybcon.sh index b546005..5544b16 100755 --- a/scripts/ybcon.sh +++ b/scripts/ybcon.sh @@ -17,7 +17,11 @@ usage() { fi } -pUsed=false +usageExit() { + usage false + exit 0 +} + args=""; run=false; skipArgsIteration=false; @@ -48,21 +52,18 @@ if [ "$#" != 0 ]; then do case "$it" in -h | --help | --version ) - usage false - exit 0 ;; + usageExit ;; -p | --printresult ) - if [ $pUsed = false ]; then - pUsed=true + if test "${args#*$it}" = "$args"; then newArgs "$it" else - usage false - exit 0 + usageExit fi ;; *.ybcon ) newArgs "$it" run=true ;; * ) - usage false ;; + usageExit ;; esac done fi