diff options
author | Martin Schwenke <martin@meltin.net> | 2017-08-11 12:49:32 +1000 |
---|---|---|
committer | Amitay Isaacs <amitay@samba.org> | 2017-08-14 05:15:25 +0200 |
commit | b71becc1501f70f26ab854460d6f833d8f4b5302 (patch) | |
tree | 35fbda8effc5756092d277c8d082eb8a93da180f /ctdb/tools/onnode | |
parent | 2b0e266d07cf62c1cbbda182aae6cdc93777cb3b (diff) | |
download | samba-b71becc1501f70f26ab854460d6f833d8f4b5302.tar.gz |
ctdb-scripts: Ignore shellcheck SC2181 warning (use of $?)
Given the size of the command substitutions it would be less clear to
embed the assignments and substitutions inside a conditional. It is
clearer if the exit code is checked afterwards.
However, do fix some untidy uses of != instead of -ne when comparing
with $?. Make the code easier to understand by reversing the logic
and using -eq and ||.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Diffstat (limited to 'ctdb/tools/onnode')
-rwxr-xr-x | ctdb/tools/onnode | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/ctdb/tools/onnode b/ctdb/tools/onnode index 0b31a826c6f..ca9673a95b9 100755 --- a/ctdb/tools/onnode +++ b/ctdb/tools/onnode @@ -81,7 +81,9 @@ parse_options () # Not on the previous line - local returns 0! temp=$(POSIXLY_CORRECT=1 getopt -n "$prog" -o "cf:hno:pqvPi" -l help -- "$@") - [ $? != 0 ] && usage + # No! Checking the exit code afterwards is actually clearer... + # shellcheck disable=SC2181 + [ $? -eq 0 ] || usage eval set -- "$temp" @@ -147,6 +149,8 @@ get_nodes_with_status () if [ -z "$ctdb_status_output" ] ; then ctdb_status_output=$(ctdb -X status 2>&1) + # No! Checking the exit code afterwards is actually clearer... + # shellcheck disable=SC2181 if [ $? -ne 0 ] ; then echo "${prog}: unable to get status of CTDB nodes" >&2 echo "$ctdb_status_output" >&2 |