From 577cd96da8c4ce97d4a87a2d21591555222d730f Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Mon, 29 May 2023 20:42:45 +0300 Subject: [PATCH] scripts: Fix options iteration in open-coredump.sh When run like 'open-coredump.sh --help' the options parsing loop doesn't run because $# == 1 and [ $# -gt 1 ] evaluates to false. The simplest fix is to parse -h|--help on its own as the options parsing loop assumes that there's core-file argument present. Signed-off-by: Pavel Emelyanov Closes #14075 --- scripts/open-coredump.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/open-coredump.sh b/scripts/open-coredump.sh index 0abd58d9ea..1ec4835c68 100755 --- a/scripts/open-coredump.sh +++ b/scripts/open-coredump.sh @@ -131,13 +131,14 @@ SCYLLA_REPO_PATH="${SCYLLA_REPO_PATH}" SCYLLA_GDB_PY_SOURCE="${SCYLLA_GDB_PY_SOURCE:-repo}" ARTIFACT_DIR=${ARTIFACT_DIR:-${SCRIPT_NAME}.dir} +if [[ $# -ge 1 && ( "$1" == "--help" || "$1" == "-h" ) ]]; then + print_usage + exit 0 +fi + while [[ $# -gt 1 ]] do case $1 in - "--help"|"-h") - print_usage - exit 0 - ;; "--verbose"|"-v") VERBOSE_LEVEL=2 shift 1