thermal: always use curly brackets when dereferencing array elements
${array[1]} is the recommended way to dereference array elements in
bash. While $array[1] may work with some implementations of bash, it
is not guaranteed to work.
Signed-off-by: Javi Merino <javi.merino@arm.com>
Acked-by: Sanjay Singh Rawat <sanjay.rawat@linaro.org>
diff --git a/include/thermal_functions.sh b/include/thermal_functions.sh
index eaf378b..bfc6620 100644
--- a/include/thermal_functions.sh
+++ b/include/thermal_functions.sh
@@ -185,7 +185,7 @@
local flag=0
for cpu in $cpus; do
- if [ $before_freq_list[$index] -ne $after_freq_list[$index] ] ; then
+ if [ ${before_freq_list[$index]} -ne ${after_freq_list[$index]} ] ; then
flag=1
fi
index=$((index + 1))
@@ -237,7 +237,7 @@
local th_zones=$(ls $THERMAL_PATH | grep "thermal_zone['$MAX_ZONE']")
for zone in $th_zones; do
- echo $mode_list[$index] > $THERMAL_PATH/$zone/mode
+ echo ${mode_list[$index]} > $THERMAL_PATH/$zone/mode
index=$((index + 1))
done
return 0