From: Martin Schwenke Date: Thu, 7 Mar 2019 04:46:48 +0000 (+1100) Subject: ctdb-tests: Fix remaining common.sh ShellCheck hits X-Git-Tag: talloc-2.2.0~72 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=627a5cf1e717aab65b99eaba4e2efe78307adbf2;p=thirdparty%2Fsamba.git ctdb-tests: Fix remaining common.sh ShellCheck hits Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- diff --git a/ctdb/tests/scripts/common.sh b/ctdb/tests/scripts/common.sh index b75fe066dcd..63df11242e7 100644 --- a/ctdb/tests/scripts/common.sh +++ b/ctdb/tests/scripts/common.sh @@ -5,13 +5,13 @@ # Print a message and exit. die () { - echo "$1" >&2 ; exit ${2:-1} + echo "$1" >&2 ; exit "${2:-1}" } # This expands the most probable problem cases like "." and "..". TEST_SUBDIR=$(dirname "$0") -if [ $(dirname "$TEST_SUBDIR") = "." ] ; then - TEST_SUBDIR=$(cd "$TEST_SUBDIR" ; pwd) +if [ "$(dirname "$TEST_SUBDIR")" = "." ] ; then + TEST_SUBDIR=$(cd "$TEST_SUBDIR" && pwd) fi . "${TEST_SCRIPTS_DIR}/script_install_paths.sh" @@ -73,8 +73,9 @@ setup_ctdb_base () [ $# -ge 2 ] || die "usage: setup_ctdb_base [item]..." # If empty arguments are passed then we attempt to remove / # (i.e. the root directory) below - [ -n "$1" -a -n "$2" ] || \ + if [ -z "$1" ] || [ -z "$2" ] ; then die "usage: setup_ctdb_base [item]..." + fi _parent="$1" _subdir="$2"