From: Martin Schwenke Date: Thu, 5 Sep 2019 23:01:36 +0000 (+1000) Subject: ctdb-tests: Avoid shellcheck warnings X-Git-Tag: talloc-2.3.1~843 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8038f4f64f4f6a77346837c1877e352be2632cd0;p=thirdparty%2Fsamba.git ctdb-tests: Avoid shellcheck warnings SC2086 Double quote to prevent globbing and word splitting This one doesn't need the double quotes if it is contained within the preceding variable expansion. SC2181 Check exit code directly with e.g. 'if mycmd;', not indirectly with $? SC2004 $/${} is unnecessary on arithmetic variables These are straightforward. Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- diff --git a/ctdb/tests/simple/scripts/local_daemons.bash b/ctdb/tests/simple/scripts/local_daemons.bash index 5da900288b2..7bba0c32333 100644 --- a/ctdb/tests/simple/scripts/local_daemons.bash +++ b/ctdb/tests/simple/scripts/local_daemons.bash @@ -36,13 +36,15 @@ setup_ctdb () ${public_addresses:+-P} ${public_addresses} \ ${CTDB_USE_IPV6:+-6} \ ${reclock_use_command:+-R} \ - ${TEST_SOCKET_WRAPPER_SO_PATH:+-S} ${TEST_SOCKET_WRAPPER_SO_PATH} + ${TEST_SOCKET_WRAPPER_SO_PATH:+-S ${TEST_SOCKET_WRAPPER_SO_PATH}} + # Burying the above in an if-statement condition reduces readability. + # shellcheck disable=SC2181 if [ $? -ne 0 ] ; then exit 1 fi local pnn - for pnn in $(seq 0 $(($TEST_LOCAL_DAEMONS - 1))) ; do + for pnn in $(seq 0 $((TEST_LOCAL_DAEMONS - 1))) ; do if $no_event_scripts ; then rm -vf "${CTDB_BASE}/events/legacy/"* fi