Fix SC2181 ("[ $?") outside tests/

Reviewed-by: John Kennedy <john.kennedy@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #12042
This commit is contained in:
наб
2021-05-14 11:55:17 +02:00
committed by Brian Behlendorf
parent d53a6969c1
commit 59d91b4d10
11 changed files with 29 additions and 52 deletions
+1 -3
View File
@@ -87,9 +87,7 @@ coverity_fix_commit()
IFS='
'
for line in $(git log -n 1 --pretty=%b "$REF" | grep -E '^CID'); do
echo "$line" | grep -E '^CID [[:digit:]]+: ([[:graph:]]+|[[:space:]])+ \(([[:upper:]]|\_)+\)' > /dev/null
# shellcheck disable=SC2181
if [ $? -ne 0 ]; then
if ! echo "$line" | grep -qE '^CID [[:digit:]]+: ([[:graph:]]+|[[:space:]])+ \(([[:upper:]]|\_)+\)'; then
echo "error: commit message has an improperly formatted CID defect line"
error=1
fi
+1 -3
View File
@@ -120,9 +120,7 @@ load_module_linux() {
echo "Loading: $FILE ($VERSION)"
fi
$LDMOD "$KMOD" >/dev/null 2>&1
# shellcheck disable=SC2181
if [ $? -ne 0 ]; then
if ! $LDMOD "$KMOD" >/dev/null 2>&1; then
echo "Failed to load $KMOD"
return 1
fi
+2 -4
View File
@@ -491,10 +491,8 @@ for TAG in $POOL_TAGS; do
POOL_NAME=$($ZPOOL_CMD import -d "$POOL_DIR_COPY" | \
awk '/pool:/ { print $2; exit 0 }')
$ZPOOL_CMD import -N -d "$POOL_DIR_COPY" \
"$POOL_NAME" &>/dev/null
# shellcheck disable=SC2181
if [ $? -ne 0 ]; then
if ! $ZPOOL_CMD import -N -d "$POOL_DIR_COPY"
"$POOL_NAME" &>/dev/null; then
fail_nonewline
ERROR=1
else
+2 -5
View File
@@ -62,11 +62,8 @@ function usage
function or_die
{
# shellcheck disable=SC2068
$@
# shellcheck disable=SC2181
if [[ $? -ne 0 ]]; then
# shellcheck disable=SC2145
echo "Command failed: $@"
if ! $@; then
echo "Command failed: $*"
exit 1
fi
}