aboutsummaryrefslogtreecommitdiffstats
path: root/package/base-files
diff options
context:
space:
mode:
authorRosen Penev <rosenp@gmail.com>2020-01-16 20:43:53 -0800
committerAdrian Schmutzler <freifunk@adrianschmutzler.de>2020-01-17 12:17:35 +0100
commitcba5fa0352869c117858bd56bebf3c1290865d99 (patch)
tree357bf2f9913924f091b086364a9855a572f0377d /package/base-files
parent1322190fd355e6d9c0f37a668a77a14bbfb2c375 (diff)
downloadupstream-cba5fa0352869c117858bd56bebf3c1290865d99.tar.gz
upstream-cba5fa0352869c117858bd56bebf3c1290865d99.tar.bz2
upstream-cba5fa0352869c117858bd56bebf3c1290865d99.zip
base-files/functions.sh: don't use $var in $(())
It's not needed. It can also lead to subtle bugs. https://github.com/koalaman/shellcheck/wiki/Sc2004 Signed-off-by: Rosen Penev <rosenp@gmail.com>
Diffstat (limited to 'package/base-files')
-rwxr-xr-xpackage/base-files/files/lib/functions.sh6
1 files changed, 3 insertions, 3 deletions
diff --git a/package/base-files/files/lib/functions.sh b/package/base-files/files/lib/functions.sh
index 81176431d1..b118c8368c 100755
--- a/package/base-files/files/lib/functions.sh
+++ b/package/base-files/files/lib/functions.sh
@@ -70,7 +70,7 @@ config () {
local cfgtype="$1"
local name="$2"
- export ${NO_EXPORT:+-n} CONFIG_NUM_SECTIONS=$(($CONFIG_NUM_SECTIONS + 1))
+ export ${NO_EXPORT:+-n} CONFIG_NUM_SECTIONS=$((CONFIG_NUM_SECTIONS + 1))
name="${name:-cfg$CONFIG_NUM_SECTIONS}"
append CONFIG_SECTIONS "$name"
export ${NO_EXPORT:+-n} CONFIG_SECTION="$name"
@@ -93,7 +93,7 @@ list() {
config_get len "$CONFIG_SECTION" "${varname}_LENGTH" 0
[ $len = 0 ] && append CONFIG_LIST_STATE "${CONFIG_SECTION}_${varname}"
- len=$(($len + 1))
+ len=$((len + 1))
config_set "$CONFIG_SECTION" "${varname}_ITEM$len" "$value"
config_set "$CONFIG_SECTION" "${varname}_LENGTH" "$len"
append "CONFIG_${CONFIG_SECTION}_${varname}" "$value" "$LIST_SEP"
@@ -162,7 +162,7 @@ config_list_foreach() {
while [ $c -le "$len" ]; do
config_get val "${section}" "${option}_ITEM$c"
eval "$function \"\$val\" \"\$@\""
- c="$(($c + 1))"
+ c="$((c + 1))"
done
}