ctdb-tests: Fix remaining common.sh ShellCheck hits
authorMartin Schwenke <martin@meltin.net>
Thu, 7 Mar 2019 04:46:48 +0000 (15:46 +1100)
committerAmitay Isaacs <amitay@samba.org>
Fri, 15 Mar 2019 05:17:14 +0000 (05:17 +0000)
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@samba.org>
ctdb/tests/scripts/common.sh

index b75fe066dcdef16f1ee4bd1d08e29badb50cb400..63df11242e7adcde840f6914086111ca797c573f 100644 (file)
@@ -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 <parent> <subdir> [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 <parent> <subdir> [item]..."
+       fi
 
        _parent="$1"
        _subdir="$2"