test: Shellcheck - correct rule: Consider using grep -c

Correct shellcheck rule SC2126: Consider using
grep -c instead of grep|wc.

Signed-off-by: Maciej Wawryk <maciejx.wawryk@intel.com>
Change-Id: Iceeef8b4fae984a95543d8d4b9fcbf90e9c073aa
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/473289
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Maciej Wawryk 2019-11-05 14:21:11 +01:00 committed by Jim Harris
parent e764b4ca5d
commit d352c44ad0
2 changed files with 2 additions and 2 deletions

View File

@ -242,7 +242,7 @@ if hash shellcheck 2>/dev/null; then
# This SHCK_EXCLUDE list is out "to do" and we work to fix all of this errors. # This SHCK_EXCLUDE list is out "to do" and we work to fix all of this errors.
SHCK_EXCLUDE="SC1083,SC2002,\ SHCK_EXCLUDE="SC1083,SC2002,\
SC2010,SC2012,SC2016,SC2034,SC2045,SC2046,SC2068,SC2086,SC2089,SC2090,\ SC2010,SC2012,SC2016,SC2034,SC2045,SC2046,SC2068,SC2086,SC2089,SC2090,\
SC2097,SC2098,SC2119,SC2120,SC2126,SC2128,\ SC2097,SC2098,SC2119,SC2120,SC2128,\
SC2129,SC2140,SC2142,SC2143,SC2154,SC2155,\ SC2129,SC2140,SC2142,SC2143,SC2154,SC2155,\
SC2162" SC2162"
# SPDK fails some error checks which have been deprecated in later versions of shellcheck. # SPDK fails some error checks which have been deprecated in later versions of shellcheck.

View File

@ -79,7 +79,7 @@ function waitforiscsidevices() {
local num=$1 local num=$1
for ((i=1; i<=20; i++)); do for ((i=1; i<=20; i++)); do
n=$( iscsiadm -m session -P 3 | grep "Attached scsi disk sd[a-z]*" | wc -l ) n=$( iscsiadm -m session -P 3 | grep -c "Attached scsi disk sd[a-z]*" || true)
if [ $n -ne $num ]; then if [ $n -ne $num ]; then
sleep 0.1 sleep 0.1
else else