From 1d2cf4e2a477646b212b25d6d6be5fee99e20bdb Mon Sep 17 00:00:00 2001
From: sunshihao <sunshihao@huawei.com>
Date: Thu, 16 Apr 2020 10:53:25 +0800
Subject: [PATCH 3/4] bugfix-sg3_utils-fix-syntax-error

---
 scripts/rescan-scsi-bus.sh | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/scripts/rescan-scsi-bus.sh b/scripts/rescan-scsi-bus.sh
index b1cbebc..25a5f2a 100755
--- a/scripts/rescan-scsi-bus.sh
+++ b/scripts/rescan-scsi-bus.sh
@@ -83,10 +83,10 @@ findhosts ()
   hosts=
   for driverdir in /proc/scsi/*; do
     driver=${driverdir#/proc/scsi/}
-    if [ "$driver" = scsi ] || [ "$driver" = sg ] || [ "$driver" = dummy ] || [ "$driver" = device_info  ] ; then continue; fi
+    if [ "$driver" = xscsi ] || [ "$driver" = xsg ] || [ "$driver" = xdummy ] || [ "$driver" = xdevice_info  ] ; then continue; fi
     for hostdir in $driverdir/*; do
       name=${hostdir#/proc/scsi/*/}
-      if [ "$name" = add_map ] || [ "$name" = map ]  || [ "$name" = mod_parm ] ; then continue; fi
+      if [ "$name" = xadd_map ] || [ "$name" = xmap ]  || [ "$name" = xmod_parm ] ; then continue; fi
       num=$name
       driverinfo=$driver
       if [ -r "$hostdir/status" ] ; then
@@ -289,7 +289,7 @@ testonline ()
     print_and_scroll_back "$host:$channel:$id:$lun $SGDEV ($RMB) "
     [ $RC = 2 ] && [ "$RMB" = "1" ] && break
   done
-  if [ $ctr != 0 ] ; then
+  if [ $xctr != x0 ] ; then
     white_out
   fi
   # echo -e "\e[A\e[A\e[A${yellow}Test existence of $SGDEV = $RC ${norm} \n\n\n"
@@ -569,7 +569,7 @@ dolunscan()
       # Device not present
       printf "\r\e[A";
       # Optimization: if lun==0, stop here (only if in non-remove mode)
-      if [ "$lun" = 0 ] && [ -z "$remove" ] && [ "$optscan" = 1 ] ; then
+      if [ "x$lun" = x0 ] && [ -z "$remove" ] && [ "x$optscan" = x1 ] ; then
         return 1;
       fi
     else
@@ -1283,7 +1283,7 @@ if [ "$sync" = 2 ] ; then
   echo "Syncing file systems"
   sync
 fi
-if [ -w /sys/module/scsi_mod/parameters/default_dev_flags ] && [ $scan_flags != 0 ] ; then
+if [ -w /sys/module/scsi_mod/parameters/default_dev_flags ] && [ x$scan_flags != x0 ] ; then
   OLD_SCANFLAGS=$(cat /sys/module/scsi_mod/parameters/default_dev_flags)
   NEW_SCANFLAGS=$((OLD_SCANFLAGS|scan_flags))
   if [ "$OLD_SCANFLAGS" != "$NEW_SCANFLAGS" ] ; then
-- 
2.19.1

