From e351dca373b048160d0f46e12736c18aa3cd58ae Mon Sep 17 00:00:00 2001 From: Michal Berger Date: Wed, 30 Sep 2020 13:32:49 +0200 Subject: [PATCH] test/nvmf: Replace [ with [[ test in allocate_nic_ips() The former will force Bash to complain if $ip consists of more than one ip address. E.g.: 1:08:55 # '[' -z 192.168.121.37 192.168.121.36 ']' line 104: [: 192.168.121.37: binary operator expected The alternative is to properly quote the $ip inside [, however, [[ is always the safest approach. Change-Id: Iced7319a106ce35a183840984aa6e6e1e52caa16 Signed-off-by: Michal Berger Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4478 Tested-by: SPDK CI Jenkins Reviewed-by: Shuhei Matsumoto Reviewed-by: Tomasz Zawadzki --- test/nvmf/common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/nvmf/common.sh b/test/nvmf/common.sh index 033d84990..397815dfb 100644 --- a/test/nvmf/common.sh +++ b/test/nvmf/common.sh @@ -101,7 +101,7 @@ function allocate_nic_ips() { ((count = NVMF_IP_LEAST_ADDR)) for nic_name in $(get_rdma_if_list); do ip="$(get_ip_address $nic_name)" - if [ -z $ip ]; then + if [[ -z $ip ]]; then ip addr add $NVMF_IP_PREFIX.$count/24 dev $nic_name ip link set $nic_name up ((count = count + 1))