meta-quanta: fix shellcheck issues

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I189baf142cc86d44ebbf615edd3bb0ec1785be8d
diff --git a/meta-quanta/meta-gsj/recipes-gsj/detect-fan-fail/files/detect-fan-fail.sh b/meta-quanta/meta-gsj/recipes-gsj/detect-fan-fail/files/detect-fan-fail.sh
index 80f1f69..20cdd6d 100644
--- a/meta-quanta/meta-gsj/recipes-gsj/detect-fan-fail/files/detect-fan-fail.sh
+++ b/meta-quanta/meta-gsj/recipes-gsj/detect-fan-fail/files/detect-fan-fail.sh
@@ -3,14 +3,14 @@
 # get fan state by d-bus command
 function get_fan_state() {
     get_property_path='xyz.openbmc_project.Sensor.Threshold.Critical CriticalAlarmLow'
-    fan_state="$(busctl get-property $1 $2 $get_property_path | awk '{print $2}')"
+    fan_state="$(busctl get-property "$1" "$2" "$get_property_path" | awk '{print $2}')"
     echo "$fan_state"
 }
 
 # set fan pwm by d-bus command
 function set_fan_value() {
     set_property_path='xyz.openbmc_project.Control.FanPwm'
-    busctl set-property $1 $2 $set_property_path Target t 255
+    busctl set-property "$1" "$2" $set_property_path Target t 255
 }
 
 fan_tach_path=( '/xyz/openbmc_project/sensors/fan_tach/Fan0_0_RPM'
@@ -24,10 +24,10 @@
 check_fail_flag=0
 current_fan_state=()
 while true; do
-    hwmon_path="$(mapper get-service ${fan_tach_path[0]})"
-    for i in ${!fan_tach_path[@]};
+    hwmon_path="$(mapper get-service "${fan_tach_path[0]}")"
+    for i in "${!fan_tach_path[@]}";
     do
-        current_fan_state[$i%2]=$(get_fan_state $hwmon_path ${fan_tach_path[$i]})
+        current_fan_state[i%2]=$(get_fan_state "$hwmon_path" "${fan_tach_path[$i]}")
 
         #Compare state of dual rotors with CriticalAlarmLow to check if fan fail
         if [ ${#current_fan_state[@]} -eq 2 ];then
@@ -35,10 +35,10 @@
             [ "${current_fan_state[1]}" == "true" ] ;then
                 if [ $check_fail_flag -eq 0 ];then
                     systemctl stop phosphor-pid-control
-                    for j in ${!fan_tach_path[@]};
+                    for j in "${!fan_tach_path[@]}";
                     do
                         #If fan fail is detect, set other fan rpm to pwm 255.
-                        set_fan_value $hwmon_path ${fan_tach_path[$j]}
+                        set_fan_value "$hwmon_path" "${fan_tach_path[$j]}"
                         check_fail_flag=1
                     done
                 fi
@@ -49,7 +49,7 @@
         fi
 
         #fans are going to normal.
-        if [ $i -eq $((${#fan_tach_path[@]}-1)) ] && [ $check_fail_flag -eq 1 ]; then
+        if [ "$i" -eq $((${#fan_tach_path[@]}-1)) ] && [ $check_fail_flag -eq 1 ]; then
            check_fail_flag=0
            systemctl restart phosphor-pid-control
         fi