From 3f9d8a0354a3e635f22a54445f1985d475c97a87 Mon Sep 17 00:00:00 2001 From: MyungJoo Ham Date: Thu, 17 Aug 2023 14:51:08 +0900 Subject: [PATCH] Use the first unrecognized argument as the path name, not the second. If there are multiple unrecognized arguments, treat only the first one as the path. This will allow to ignore invalid arguments if it has given the path for backward compatibility in the future. Signed-off-by: MyungJoo Ham --- ssat.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ssat.sh b/ssat.sh index 5461ba3..5916f55 100755 --- a/ssat.sh +++ b/ssat.sh @@ -34,6 +34,7 @@ ## - Version : 1.2.0 TARGET=$(pwd) +TARGET_ASSIGNED=0 BASEPATH=`dirname "$0"` BASENAME=`basename "$0"` TESTCASE="runTest.sh" @@ -204,7 +205,13 @@ do shift ;; *) # Unknown, which is probably target (the path to root-dir of test groups). - TARGET="$1" + # If this is the second occurrence, ignore it. + # Assume that the previous string is path and the later string is an invalid argument. + if [ $TARGET_ASSIGNED -eq 0 ] + then + TARGET="$1" + TARGET_ASSIGNED=1 + fi shift esac done -- 2.7.4