From f924c94b4cc4cea3f7ba97d22e295edd5f459715 Mon Sep 17 00:00:00 2001 From: Maciej Wawryk Date: Mon, 18 Nov 2019 11:54:15 +0100 Subject: [PATCH] test: Shellcheck - correct rule: Use grep -q... Correct shellcheck rule SC2143: Use grep -q instead of comparing output with [ -n .. ]. Change-Id: Ibfce9633eda332c64b27914b2fde51c9a26ff7f3 Signed-off-by: Maciej Wawryk Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/474957 Tested-by: SPDK CI Jenkins Reviewed-by: Ben Walker Reviewed-by: Jim Harris Reviewed-by: Shuhei Matsumoto --- scripts/check_format.sh | 2 +- test/nvmf/common.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/check_format.sh b/scripts/check_format.sh index bf7d549e8..adb5153af 100755 --- a/scripts/check_format.sh +++ b/scripts/check_format.sh @@ -243,7 +243,7 @@ if hash shellcheck 2>/dev/null; then SHCK_EXCLUDE="SC1083,SC2002,\ SC2010,SC2012,SC2016,SC2034,SC2045,SC2046,SC2068,SC2086,SC2089,SC2090,\ SC2097,SC2098,SC2119,SC2120,SC2128,\ -SC2129,SC2143" +SC2129" # SPDK fails some error checks which have been deprecated in later versions of shellcheck. # We will not try to fix these error checks, but instead just leave the error types here # so that we can still run with older versions of shellcheck. diff --git a/test/nvmf/common.sh b/test/nvmf/common.sh index bc4c0998e..b904bd42d 100644 --- a/test/nvmf/common.sh +++ b/test/nvmf/common.sh @@ -246,7 +246,7 @@ function check_ip_is_soft_roce() IP=$1 if hash rxe_cfg; then dev=$(ip -4 -o addr show | grep $IP | cut -d" " -f2) - if [ -z $(rxe_cfg | grep $dev | awk '{print $4}' | grep "rxe") ]; then + if (rxe_cfg | grep $dev | awk '{print $4}' | grep -q "rxe"); then return 1 else return 0