diff mbox series

[4/4] base-files/functions.sh: quote variables in []

Message ID 20200920053140.35255-4-rosenp@gmail.com
State Superseded
Headers show
Series [1/4] base-files/functions.sh: read grep output by line | expand

Commit Message

Rosen Penev Sept. 20, 2020, 5:31 a.m. UTC
ash does not support [[]] syntax, which makes this redundant.

Found with https://github.com/koalaman/shellcheck/wiki/Sc2086

Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 package/base-files/files/lib/functions.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/package/base-files/files/lib/functions.sh b/package/base-files/files/lib/functions.sh
index a7ff50cb1a..8ada3c376a 100755
--- a/package/base-files/files/lib/functions.sh
+++ b/package/base-files/files/lib/functions.sh
@@ -92,7 +92,7 @@  list() {
 	local len
 
 	config_get len "$CONFIG_SECTION" "${varname}_LENGTH" 0
-	[ $len = 0 ] && append CONFIG_LIST_STATE "${CONFIG_SECTION}_${varname}"
+	[ "$len" = 0 ] && append CONFIG_LIST_STATE "${CONFIG_SECTION}_${varname}"
 	len=$((len + 1))
 	config_set "$CONFIG_SECTION" "${varname}_ITEM$len" "$value"
 	config_set "$CONFIG_SECTION" "${varname}_LENGTH" "$len"
@@ -164,7 +164,7 @@  config_list_foreach() {
 
 	config_get len "${section}" "${option}_LENGTH"
 	[ -z "$len" ] && return 0
-	while [ $c -le "$len" ]; do
+	while [ "$c" -le "$len" ]; do
 		config_get val "${section}" "${option}_ITEM$c"
 		eval "$function \"\$val\" \"\$@\""
 		c="$((c + 1))"