From f4ef4a5a3e7bef5945cd197ec0b5e33143bc7d43 Mon Sep 17 00:00:00 2001 From: Amos Kong Date: Sun, 12 Nov 2017 15:39:24 +0000 Subject: [PATCH] scripts: process empty string in arguments Examples: # scripts/scylla-jmx -l /usr/lib/scylla/jmx "" Result: script stuck # scripts/scylla-jmx "" -l /usr/lib/scylla/jmx Unknown parameter: /usr/lib/scylla/jmx Result: wrongly shift arguments Above two problem caused by a redundant argument parse ("$PARAM_PORT"), the variable isn't set, so it's a covert empty string. The others valid 9 options are all parsed with right case, and API_ADDR also be set by other case path, so it's safe to remove $PARAM_PORT. This patch removed the redundant argument, and skipped empty string in arguments. Signed-off-by: Amos Kong Message-Id: <74c3f75d58bab1a8348f2c87f58825eed4c5b705.1510501133.git.amos@scylladb.com> --- scripts/scylla-jmx | 4 ---- 1 file changed, 4 deletions(-) diff --git a/scripts/scylla-jmx b/scripts/scylla-jmx index 2e8a148..692bb39 100755 --- a/scripts/scylla-jmx +++ b/scripts/scylla-jmx @@ -63,10 +63,6 @@ do API_ADDR="-Dapiaddress="$2 shift 2 ;; - "$PARAM_PORT") - API_ADDR=$2 - shift 2 - ;; "$PARAM_JMX_PORT") JMX_PORT=$2 shift 2