test: Shellcheck - correct rule: "Can't use =~ in [ ]"

Correct shellcheck rule SC2074: Can't use =~ in [ ]. Use [[..]] instead.

Signed-off-by: Maciej Wawryk <maciejx.wawryk@intel.com>
Change-Id: I34ae5e6d6fef37be3ad5d79efe4f06cf318aa696
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/469825
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Maciej Wawryk 2019-09-30 11:24:11 +02:00 committed by Jim Harris
parent 1dbe784a40
commit 6e03b6ba57
2 changed files with 3 additions and 3 deletions

View File

@ -243,7 +243,7 @@ if hash shellcheck 2>/dev/null; then
SC1083,SC1090,SC1091,SC1113,SC2001,SC2002,SC2003,SC2004,SC2005,\
SC2010,SC2012,SC2013,SC2015,SC2016,SC2018,SC2019,SC2022,\
SC2027,SC2030,SC2031,SC2034,SC2035,SC2039,SC2043,SC2044,SC2045,SC2046,\
SC2068,SC2074,SC2086,SC2088,SC2089,SC2090,SC2091,SC2094,\
SC2068,SC2086,SC2088,SC2089,SC2090,SC2091,SC2094,\
SC2097,SC2098,SC2103,SC2115,SC2116,SC2119,SC2120,SC2121,SC2124,SC2126,SC2128,\
SC2129,SC2140,SC2142,SC2143,SC2145,SC2146,SC2148,SC2152,SC2153,SC2154,SC2155,\
SC2162,SC2164,SC2165,SC2166,SC2167,SC2174,SC2178,SC2181,\

View File

@ -91,9 +91,9 @@ timing_exit run_iscsi_app
timing_enter iscsi_config
bdevs=($($rpc_py bdev_get_bdevs | jq -r '.[].name'))
if [ $DISKNO == "ALL" ] || [ $DISKNO == "all" ]; then
if [[ $DISKNO == "ALL" ]] || [[ $DISKNO == "all" ]]; then
DISKNO=${#bdevs[@]}
elif [ $DISKNO -gt ${#bdevs[@]} ] || [ ! $DISKNO =~ ^[0-9]+$ ]; then
elif [[ $DISKNO -gt ${#bdevs[@]} ]] || [[ ! $DISKNO =~ ^[0-9]+$ ]]; then
error "Required device number ($DISKNO) is not a valid number or it's larger than the number of devices found (${#bdevs[@]})"
fi