summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2011-11-10 21:46:08 -0500
committerMike Frysinger <vapier@gentoo.org>2011-11-19 02:25:36 -0500
commitef1ff1b4f29762d1caf83dc2b65ccfc7cb96e140 (patch)
treef1ebb65eec6eb156a0fba737bcd5386af2a9ebfe
parent0510c473d4cd9097401e3a7bc236b0121977b81d (diff)
downloadopenrc-ef1ff1b4f29762d1caf83dc2b65ccfc7cb96e140.tar.gz
openrc-ef1ff1b4f29762d1caf83dc2b65ccfc7cb96e140.tar.bz2
openrc-ef1ff1b4f29762d1caf83dc2b65ccfc7cb96e140.tar.xz
make shell math operations style more succulent
Convert the style: var=$((${var} + 1)) to: : $(( var += 1 )) The latter is easier to read imo. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
-rw-r--r--init.d/consolefont.in2
-rw-r--r--init.d/hwclock.in4
-rw-r--r--init.d/keymaps.in2
-rw-r--r--init.d/mixer.in4
-rw-r--r--init.d/modules.in2
-rw-r--r--init.d/moused.in2
-rw-r--r--init.d/net.lo.in22
-rw-r--r--init.d/network.in2
-rw-r--r--init.d/numlock.in2
-rw-r--r--init.d/rc-enabled.in4
-rw-r--r--init.d/termencoding.in2
-rw-r--r--init.d/urandom.in2
-rw-r--r--man/runscript.82
-rw-r--r--net/apipa.sh8
-rw-r--r--net/arping.sh2
-rw-r--r--net/clip.sh2
-rw-r--r--net/ifconfig.sh.BSD.in4
-rw-r--r--net/ifconfig.sh.Linux.in26
-rw-r--r--net/ifplugd.sh2
-rw-r--r--net/ip6to4.sh4
-rw-r--r--net/iproute2.sh6
-rw-r--r--net/iwconfig.sh.BSD.in32
-rw-r--r--net/iwconfig.sh.Linux.in30
-rw-r--r--net/netplugd.sh2
-rw-r--r--net/pppd.sh2
-rw-r--r--net/tuntap.sh2
-rw-r--r--net/wpa_supplicant.sh2
-rw-r--r--sh/functions.sh.in4
-rw-r--r--sh/rc-mount.sh2
-rwxr-xr-xsh/runtests.sh6
-rwxr-xr-xsrc/test/runtests.sh6
-rwxr-xr-xsupport/openvpn/up.sh2
32 files changed, 98 insertions, 98 deletions
diff --git a/init.d/consolefont.in b/init.d/consolefont.in
index cd0c8de..f83b003 100644
--- a/init.d/consolefont.in
+++ b/init.d/consolefont.in
@@ -49,7 +49,7 @@ start()
retval=1
break
fi
- x=$(($x + 1))
+ : $(( x += 1 ))
done
eend $retval
diff --git a/init.d/hwclock.in b/init.d/hwclock.in
index b79ff7c..cfb25ae 100644
--- a/init.d/hwclock.in
+++ b/init.d/hwclock.in
@@ -85,7 +85,7 @@ start()
if [ -e /etc/adjtime ] && yesno $clock_adjfile; then
_hwclock --adjust $utc_cmd
- retval=$(($retval + $?))
+ : $(( retval += $? ))
fi
# If setting UTC, don't bother to run hwclock when first booting
@@ -99,7 +99,7 @@ start()
else
_hwclock --systz $utc_cmd $clock_args
fi
- retval=$(($retval + $?))
+ : $(( retval += $? ))
fi
eend $retval "Failed to set the system clock"
diff --git a/init.d/keymaps.in b/init.d/keymaps.in
index a7bb085..1b96f49 100644
--- a/init.d/keymaps.in
+++ b/init.d/keymaps.in
@@ -47,7 +47,7 @@ start()
n=1
while [ $n -le $ttyn ]; do
kbd_mode $kmode -C $ttydev$n
- n=$(($n + 1))
+ : $(( n += 1 ))
done
eend 0
diff --git a/init.d/mixer.in b/init.d/mixer.in
index bb42886..a08aea1 100644
--- a/init.d/mixer.in
+++ b/init.d/mixer.in
@@ -21,7 +21,7 @@ restore()
mixer -f "$mixer" \
$(cat "/var/db/${mixer#/dev/}-state") >/dev/null
veend $?
- : $((retval += $?))
+ : $(( retval += $? ))
fi
done
}
@@ -40,7 +40,7 @@ stop()
vebegin "$mixer"
mixer -f "$mixer" -s >/var/db/"${mixer#/dev/}"-state
veend $?
- : $((retval += $?))
+ : $(( retval += $? ))
done
eoutdent
eend $retval
diff --git a/init.d/modules.in b/init.d/modules.in
index e673763..72f14e7 100644
--- a/init.d/modules.in
+++ b/init.d/modules.in
@@ -57,7 +57,7 @@ start()
[ -z "$args" ] && eval args=\$module_${aa}_args
[ -z "$args" ] && eval args=\$module_${xx}_args
eval modprobe -q "$mpargs" "$x" "$args"
- eend $? "Failed to load $x" && cnt=$(($cnt + 1))
+ eend $? "Failed to load $x" && : $(( cnt += 1 ))
done
einfo "Autoloaded $cnt module(s)"
}
diff --git a/init.d/moused.in b/init.d/moused.in
index a41005f..cdcf36a 100644
--- a/init.d/moused.in
+++ b/init.d/moused.in
@@ -54,7 +54,7 @@ start()
local ttyv=
for ttyv in /dev/ttyv*; do
vidcontrol < "$ttyv" -m on
- : $((retval+= $?))
+ : $(( retval += $? ))
done
fi
diff --git a/init.d/net.lo.in b/init.d/net.lo.in
index 66e1945..d647f31 100644
--- a/init.d/net.lo.in
+++ b/init.d/net.lo.in
@@ -115,7 +115,7 @@ _wait_for_carrier()
eend 0
return 0
fi
- timeout=$((${timeout} - 1))
+ : $(( timeout -= 1 ))
[ "${efunc}" = "einfon" ] && printf "."
done
@@ -144,9 +144,9 @@ _netmask2cidr()
local i= len=
local IFS=.
for i in $1; do
- while [ ${i} != "0" ]; do
- len=$((${len} + ${i} % 2))
- i=$((${i} >> 1))
+ while [ i -ne 0 ]; do
+ : $(( len += i % 2 ))
+ : $(( i >>= 1 ))
done
done
@@ -277,7 +277,7 @@ _gen_module_list()
echo "module_${i}_program_start='${PROGRAM_START}'" >> "${MODULESLIST}"
echo "module_${i}_program_stop='${PROGRAM_STOP}'" >> "${MODULESLIST}"
echo "module_${i}_provide='${PROVIDE}'" >> "${MODULESLIST}"
- i=$((${i} + 1))
+ : $(( i += 1 ))
done
echo "module_${i}=" >> "${MODULESLIST}"
)
@@ -304,7 +304,7 @@ _load_modules()
local i=-1 x= mod= f= provides=
while true; do
- i=$((${i} + 1))
+ : $(( i += 1 ))
eval mod=\$module_${i}
[ -z "${mod}" ] && break
[ -e "${MODULESDIR}/${mod}.sh" ] || continue
@@ -438,7 +438,7 @@ _load_config()
# so modules can influence it
for cmd; do
eval config_${config_index}="'${cmd}'"
- config_index=$((${config_index} + 1))
+ : $(( config_index += 1 ))
done
# Terminate the list
eval config_${config_index}=
@@ -446,7 +446,7 @@ _load_config()
config_index=0
for cmd in ${fallback}; do
eval fallback_${config_index}="'${cmd}'"
- config_index=$((${config_index} + 1))
+ : $(( config_index += 1 ))
done
# Terminate the list
eval fallback_${config_index}=
@@ -541,7 +541,7 @@ start()
if [ -n "${our_metric}" ]; then
metric=${our_metric}
elif [ "${IFACE}" != "lo" -a "${IFACE}" != "lo0" ]; then
- metric=$((${metric} + $(_ifindex)))
+ : $(( metric += $(_ifindex) ))
fi
while true; do
@@ -581,11 +581,11 @@ start()
eindent
eval config_${config_index}=\$config
unset fallback_${config_index}
- config_index=$((${config_index} - 1))
+ : $(( config_index -= 1 ))
fi
fi
eoutdent
- config_index=$((${config_index} + 1))
+ : $(( config_index += 1 ))
done
if ! ${oneworked}; then
diff --git a/init.d/network.in b/init.d/network.in
index c934129..1c70785 100644
--- a/init.d/network.in
+++ b/init.d/network.in
@@ -287,7 +287,7 @@ start()
tentative || break
[ $r = 5 ] && vebegin "Waiting for tentative addresses"
sleep 1
- r=$(($r - 1))
+ : $(( r -= 1 ))
done
if [ $r != 5 ]; then
[ $r != 0 ]
diff --git a/init.d/numlock.in b/init.d/numlock.in
index c5b894a..3cb8bee 100644
--- a/init.d/numlock.in
+++ b/init.d/numlock.in
@@ -21,7 +21,7 @@ _setleds()
while [ $i -le $ttyn ]; do
setleds -D "$1"num < $dev$i || retval=1
- i=$(($i + 1))
+ : $(( i += 1 ))
done
return $retval
diff --git a/init.d/rc-enabled.in b/init.d/rc-enabled.in
index aff2a40..9ba73b0 100644
--- a/init.d/rc-enabled.in
+++ b/init.d/rc-enabled.in
@@ -33,7 +33,7 @@ start()
# Good to go!
"$svc" start && started="$started $svc"
- : $((retval += $?))
+ : $(( retval += $? ))
done
service_set_value started "$started"
eend $retval "Some local rc services failed to start"
@@ -46,7 +46,7 @@ stop()
local svc= retval=0
for svc in $(rcorder $(service_get_value started) 2>/dev/null | sort -r); do
"$svc" stop
- : $((retval += $?))
+ : $(( retval += $? ))
done
eend $retval "Some local rc services failed to stop"
return 0
diff --git a/init.d/termencoding.in b/init.d/termencoding.in
index 68e49b7..edba715 100644
--- a/init.d/termencoding.in
+++ b/init.d/termencoding.in
@@ -31,7 +31,7 @@ start()
n=1
while [ ${n} -le "$ttyn" ]; do
printf "\033%s" "$termencoding" >$ttydev$n
- n=$(($n + 1))
+ : $(( n += 1 ))
done
# Save the encoding for use immediately at boot
diff --git a/init.d/urandom.in b/init.d/urandom.in
index 8233f82..7fe5e59 100644
--- a/init.d/urandom.in
+++ b/init.d/urandom.in
@@ -16,7 +16,7 @@ save_seed()
local psz=1
if [ -e /proc/sys/kernel/random/poolsize ]; then
- psz=$(($(cat /proc/sys/kernel/random/poolsize) / 4096))
+ : $(( psz = $(cat /proc/sys/kernel/random/poolsize) / 4096 ))
fi
( # sub shell to prevent umask pollution
diff --git a/man/runscript.8 b/man/runscript.8
index b28bec2..64da26c 100644
--- a/man/runscript.8
+++ b/man/runscript.8
@@ -449,7 +449,7 @@ eat()
veinfo "Eating `basename ${food}`"
${command} --eat ${food}
retval=$?
- : $((${result} += ${retval}))
+ : $(( result += retval ))
[ ${retval} = 0 ] && ate="${ate} `basename ${food}`"
done
diff --git a/net/apipa.sh b/net/apipa.sh
index 3163104..ae61233 100644
--- a/net/apipa.sh
+++ b/net/apipa.sh
@@ -26,20 +26,20 @@ apipa_start()
eindent
while [ ${i} -lt 64516 ]; do
- i1=$((($(_random) % 255) + 1))
- i2=$((($(_random) % 255) + 1))
+ : $(( i1 = (_random % 255) + 1 ))
+ : $(( i2 = (_random % 255) + 1 ))
addr="169.254.${i1}.${i2}"
vebegin "${addr}/16"
if ! arping_address "${addr}"; then
eval config_${config_index}="\"${addr}/16 broadcast 169.254.255.255\""
- config_index=$((${config_index} - 1))
+ : $(( config_index -= 1 ))
veend 0
eoutdent
return 0
fi
- i=$((${i} + 1))
+ : $(( i += 1 ))
done
eerror "No free address found!"
diff --git a/net/arping.sh b/net/arping.sh
index b77d70c..83360d7 100644
--- a/net/arping.sh
+++ b/net/arping.sh
@@ -34,7 +34,7 @@ arping_address()
while [ ${w} -gt 0 -a -z "${foundmac}" ]; do
foundmac="$(arping2 ${opts} -r -c 1 -i "${IFACE}" "${ip}" 2>/dev/null | \
sed -e 'y/abcdef/ABCDEF/')"
- w=$((${w} - 1))
+ : $(( w -= 1 ))
done
else
[ -z "$(_get_inet_address)" ] && opts="${opts} -D"
diff --git a/net/clip.sh b/net/clip.sh
index 35efa3f..2fc290f 100644
--- a/net/clip.sh
+++ b/net/clip.sh
@@ -148,7 +148,7 @@ clip_post_start()
local nleftretries=10 emsg= ecode=
while [ ${nleftretries} -gt 0 ]; do
- nleftretries=$((${nleftretries} - 1))
+ : $(( nleftretries -= 1 ))
emsg="$(atmarp -s "${peerip}" "${ifvpivci}" "$@" 2>&1)"
ecode=$? && break
sleep 2
diff --git a/net/ifconfig.sh.BSD.in b/net/ifconfig.sh.BSD.in
index c0c75f0..15c8fb8 100644
--- a/net/ifconfig.sh.BSD.in
+++ b/net/ifconfig.sh.BSD.in
@@ -38,7 +38,7 @@ _ifindex()
echo "${x#/dev/net}"
return 0
fi
- i=$((${i} + 1))
+ : $(( i += 1 ))
done
;;
default)
@@ -47,7 +47,7 @@ _ifindex()
echo "${i}"
return 0
fi
- i=$((${i} + 1))
+ : $(( i += 1 ))
done
;;
esac
diff --git a/net/ifconfig.sh.Linux.in b/net/ifconfig.sh.Linux.in
index a5540c0..dcbd628 100644
--- a/net/ifconfig.sh.Linux.in
+++ b/net/ifconfig.sh.Linux.in
@@ -26,7 +26,7 @@ _ifindex()
{
local line= i=-2
while read line; do
- i=$((${i} + 1))
+ : $(( i += 1 ))
[ ${i} -lt 1 ] && continue
case "${line}" in
"${IFACE}:"*) echo "${i}"; return 0;;
@@ -34,7 +34,7 @@ _ifindex()
done < /proc/net/dev
# Return the next available index
- i=$((${i} + 1))
+ : $(( i += 1 ))
echo "${i}"
return 1
}
@@ -96,7 +96,7 @@ _get_inet_addresses()
_exists || break
local addr="$(_get_inet_address)"
[ -n "${addr}" ] && addrs="${addrs}${addrs:+ }${addr}"
- i=$((${i} + 1))
+ : $(( i += 1 ))
done
echo "${addrs}"
}
@@ -106,26 +106,26 @@ _cidr2netmask()
local cidr="$1" netmask="" done=0 i=0 sum=0 cur=128
local octets= frac=
- local octets=$((${cidr} / 8))
- local frac=$((${cidr} % 8))
+ local octets=$(( cidr / 8 ))
+ local frac=$(( cidr % 8 ))
while [ ${octets} -gt 0 ]; do
netmask="${netmask}.255"
- octets=$((${octets} - 1))
- done=$((${done} + 1))
+ : $(( octets -= 1 ))
+ : $(( done += 1 ))
done
if [ ${done} -lt 4 ]; then
while [ ${i} -lt ${frac} ]; do
- sum=$((${sum} + ${cur}))
- cur=$((${cur} / 2))
- i=$((${i} + 1))
+ : $(( sum += cur ))
+ : $(( cur /= 2 ))
+ : $(( i += 1 ))
done
netmask="${netmask}.${sum}"
- done=$((${done} + 1))
+ : $(( done += 1 ))
while [ ${done} -lt 4 ]; do
netmask="${netmask}.0"
- done=$((${done} + 1))
+ : $(( done += 1 ))
done
fi
@@ -150,7 +150,7 @@ _add_address()
# Get the last alias made for the interface and add 1 to it
i=$(ifconfig | sed '1!G;h;$!d' | grep -m 1 -o "^${iface}:[0-9]*" \
| sed -n -e 's/'"${iface}"'://p')
- i=$((${i:-0} + 1))
+ : $(( i = ${i:-0} + 1 ))
iface="${iface}:${i}"
fi
diff --git a/net/ifplugd.sh b/net/ifplugd.sh
index d048b61..0bcde2f 100644
--- a/net/ifplugd.sh
+++ b/net/ifplugd.sh
@@ -72,7 +72,7 @@ ifplugd_pre_start()
fi
sleep 1
[ ${timeout} -eq 0 ] && continue
- i=$((${i} + 1))
+ : $(( i += 1 ))
[ ${i} -ge ${timeout} ] && break
done
diff --git a/net/ip6to4.sh b/net/ip6to4.sh
index 0e94293..4564450 100644
--- a/net/ip6to4.sh
+++ b/net/ip6to4.sh
@@ -51,7 +51,7 @@ ip6to4_start()
case "${ip}" in
172.${i}.*) break;;
esac
- i=$((${i} + 1))
+ : $(( i += 1 ))
done
[ ${i} -lt 32 ] && continue
;;
@@ -90,7 +90,7 @@ ip6to4_start()
# Now apply our config
eval config_${config_index}=\'"${new}"\'
- config_index=$((${config_index} - 1))
+ : $(( config_index -= 1 ))
# Add a route for us, ensuring we don't delete anything else
local routes="$(_get_array "routes_${IFVAR}")
diff --git a/net/iproute2.sh b/net/iproute2.sh
index 660d514..91282ea 100644
--- a/net/iproute2.sh
+++ b/net/iproute2.sh
@@ -36,7 +36,7 @@ _ifindex()
{
local line= i=-2
while read line; do
- i=$((${i} + 1))
+ : $(( i += 1 ))
[ ${i} -lt 1 ] && continue
case "${line}" in
"${IFACE}:"*) echo "${i}"; return 0;;
@@ -44,7 +44,7 @@ _ifindex()
done < /proc/net/dev
# Return the next available index
- i=$((${i} + 1))
+ : $(( i += 1 ))
echo "${i}"
return 1
}
@@ -290,7 +290,7 @@ iproute2_post_start()
while [ $n -ge 0 ]; do
_iproute2_ipv6_tentative || break
sleep 1
- n=$(($n - 1))
+ : $(( n -= 1 ))
done
[ $n -ge 0 ]
eend $?
diff --git a/net/iwconfig.sh.BSD.in b/net/iwconfig.sh.BSD.in
index 850d70b..3acaf66 100644
--- a/net/iwconfig.sh.BSD.in
+++ b/net/iwconfig.sh.BSD.in
@@ -218,7 +218,7 @@ iwconfig_associate()
sleep 1
[ ${timeout} -eq 0 ] && continue
- i=$((${i} + 1))
+ : $(( i += 1 ))
[ ${i} -ge ${timeout} ] && { eend 1; return 1; }
done
@@ -252,13 +252,13 @@ iwconfig_scan()
scan="$(LC_ALL=C ifconfig -v "${IFACE}" list scan 2>/dev/null | sed -e "1 d" -e "s/$/'/g" -e "s/^/'/g")"
while [ ${i} -lt 3 -a -z "${scan}" ] ; do
scan="${scan}${scan:+ }$(LC_ALL=C ifconfig -v "${IFACE}" scan 2>/dev/null | sed -e "1 d" -e "s/$/'/g" -e "s/^/'/g")"
- i=$((${i} + 1))
+ : $(( i += 1 ))
done
APS=-1
eval set -- ${scan}
for line in "$@" ; do
- APS=$((${APS} + 1))
+ : $(( APS += 1 ))
set -- ${line}
while true ; do
case "$1" in
@@ -276,7 +276,7 @@ iwconfig_scan()
# Add 1000 for managed nodes as we prefer them to adhoc
set -- $*
case "$1" in
- *E*) eval QUAL_${APS}=$((${quality} + 1000)) ;;
+ *E*) eval QUAL_${APS}=$(( quality + 1000 )) ;;
*) eval QUAL_${APS}=\$quality ;;
esac
done
@@ -290,7 +290,7 @@ iwconfig_scan()
# Sort based on quality
local i=0 k=1 a= b= x= t=
while [ ${i} -lt ${APS} ] ; do
- k=$((${i} + 1))
+ : $(( k = i + 1 ))
while [ ${k} -le ${APS} ] ; do
eval a=\$QUALITY_${i}
[ -z "${a}" ] && break
@@ -302,15 +302,15 @@ iwconfig_scan()
eval ${x}_${k}=\$t
done
fi
- k=$((${k} + 1))
+ : $(( k += 1 ))
done
- i=$((${i} + 1))
+ : $(( i += 1 ))
done
# Strip any duplicates
local i=0 k=1 a= b=
while [ ${i} -lt ${APS} ] ; do
- k=$((${i} + 1))
+ : $(( k = i + 1 ))
while [ ${k} -le ${APS} ] ; do
eval a=\$MAC_${i}
eval b=\$MAC_${k}
@@ -327,9 +327,9 @@ iwconfig_scan()
unset MAC_${k} SSID_${k} CHAN_${k} QUALITY_${k} CAPS_${k}
fi
fi
- k=$((${k} + 1))
+ : $(( k += 1 ))
done
- i=$((${i} + 1))
+ : $(( i += 1 ))
done
local i=0 e= m= s=
@@ -337,7 +337,7 @@ iwconfig_scan()
while [ ${i} -le ${APS} ] ; do
eval x=\$MAC_${i}
if [ -z "${x}" ] ; then
- i=$((${i} + 1))
+ : $(( i += 1 ))
continue
fi
@@ -374,7 +374,7 @@ iwconfig_scan()
unset SSID_${i} MAC_${i} CHAN_${i} QUALITY_${i} CAPS_${i}
fi
done
- i=$((${i} + 1))
+ : $(( i += 1 ))
done
eoutdent
return 0
@@ -396,7 +396,7 @@ iwconfig_force_preferred()
found_AP=true
break
fi
- i=$((${i} + 1))
+ : $(( i += 1 ))
done
if ! ${found_AP} ; then
SSID=${ssid}
@@ -428,7 +428,7 @@ iwconfig_connect_preferred()
iwconfig_associate "${mac}" \
"${chan}" "${caps}" && return 0
fi
- i=$((${i} + 1))
+ : $(( i += 1 ))
done
done
@@ -442,7 +442,7 @@ iwconfig_connect_not_preferred()
while [ ${i} -le ${APS} ] ; do
eval e=\$SSID_${i}
if [ -z "${e}" ] ; then
- i=$((${i} + 1))
+ : $(( i += 1 ))
continue
fi
@@ -465,7 +465,7 @@ iwconfig_connect_not_preferred()
iwconfig_associate "${mac}" \
"${chan}" "${caps}" && return 0
fi
- i=$((${i} + 1))
+ : $(( i += 1 ))
done
return 1
diff --git a/net/iwconfig.sh.Linux.in b/net/iwconfig.sh.Linux.in
index 199678f..293bc1f 100644
--- a/net/iwconfig.sh.Linux.in
+++ b/net/iwconfig.sh.Linux.in
@@ -39,7 +39,7 @@ _get_ssid()
return 0
fi
sleep 1
- i=$((${i} - 1))
+ : $(( i -= 1 ))
done
return 1
@@ -229,7 +229,7 @@ iwconfig_wait_for_association()
sleep 1
[ ${timeout} -eq 0 ] && continue
- i=$((${i} + 1))
+ : $(( i += 1 ))
[ ${i} -ge ${timeout} ] && return 1
done
return 1
@@ -347,7 +347,7 @@ iwconfig_scan()
;;
esac
fi
- i=$((${i} + 1))
+ : $(( i += 1 ))
done
if [ -z "${scan}" ]; then
@@ -377,7 +377,7 @@ iwconfig_scan()
for line; do
case "${line}" in
*Address:*)
- APS=$((${APS} + 1))
+ : $(( APS += 1 ))
eval MAC_${APS}="\""$(echo "${line#*: }" | tr '[:lower:]' '[:upper:]')"\""
eval QUALITY_${APS}=0
;;
@@ -427,7 +427,7 @@ iwconfig_scan()
# Sort based on quality
local i=0 k=1 a= b= x= t=
while [ ${i} -lt ${APS} ]; do
- k=$((${i} + 1))
+ : $(( k = i + 1 ))
while [ ${k} -le ${APS} ]; do
eval a=\$QUALITY_${i}
[ -z "${a}" ] && break
@@ -439,15 +439,15 @@ iwconfig_scan()
eval ${x}_${k}=\$t
done
fi
- k=$((${k} + 1))
+ : $(( k += 1 ))
done
- i=$((${i} + 1))
+ : $(( i += 1 ))
done
# Strip any duplicates
local i=0 k=1 a= b=
while [ ${i} -lt ${APS} ]; do
- k=$((${i} + 1))
+ : $(( k = i + 1 ))
while [ ${k} -le ${APS} ]; do
eval a=\$MAC_${i}
eval b=\$MAC_${k}
@@ -459,9 +459,9 @@ iwconfig_scan()
[ -n "${a}" -a -n "${b}" ] && [ "${a}" -lt "${b}" ] && u=${i}
unset MAC_${u} SSID_${u} MODE_${u} CHAN_${u} QUALITY_${u} ENC_${u}
fi
- k=$((${k} + 1))
+ : $(( k += 1 ))
done
- i=$((${i} + 1))
+ : $(( i += 1 ))
done
local i=0 e= m= s=
@@ -469,7 +469,7 @@ iwconfig_scan()
while [ ${i} -le ${APS} ]; do
eval x=\$MAC_${i}
if [ -z "${x}" ]; then
- i=$((${i} + 1))
+ : $(( i += 1 ))
continue
fi
@@ -506,7 +506,7 @@ iwconfig_scan()
unset SSID_${i} MAC_${i} ${MODE}_${i} CHAN_${i} QUALITY_${i} ENC_${i}
fi
done
- i=$((${i} + 1))
+ : $(( i += 1 ))
done
eoutdent
}
@@ -526,7 +526,7 @@ iwconfig_force_preferred()
found_AP=true
break
fi
- i=$((${i} + 1))
+ : $(( i += 1 ))
done
if ! ${found_AP}; then
SSID=${ssid}
@@ -559,7 +559,7 @@ iwconfig_connect_preferred()
iwconfig_associate "${mode}" "${mac}" "${enc}" "${freq}" \
"${chan}" && return 0
fi
- i=$((${i} + 1))
+ : $(( i += 1 ))
done
done
@@ -593,7 +593,7 @@ iwconfig_connect_not_preferred()
"${chan}" && return 0
fi
fi
- i=$((${i} + 1))
+ : $(( i += 1 ))
done
return 1
diff --git a/net/netplugd.sh b/net/netplugd.sh
index f7df7a3..f43a5e6 100644
--- a/net/netplugd.sh
+++ b/net/netplugd.sh
@@ -74,7 +74,7 @@ netplugd_pre_start()
fi
sleep 1
[ ${timeout} -eq 0 ] && continue
- i=$((${i} + 1))
+ : $(( i += 1 ))
[ ${i} -ge ${timeout} ] && break
done
diff --git a/net/pppd.sh b/net/pppd.sh
index 1f9d302..97bd3ee 100644
--- a/net/pppd.sh
+++ b/net/pppd.sh
@@ -96,7 +96,7 @@ pppd_pre_start()
if ! ${hasdefaultmetric}; then
local m=
eval m=\$metric_${IFVAR}
- [ -z "${m}" ] && m=$((${metric} + $(_ifindex)))
+ [ -z "${m}" ] && : $(( m = metric + $(_ifindex) ))
opts="${opts} defaultmetric ${m}"
fi
if [ -n "${mtu}" ]; then
diff --git a/net/tuntap.sh b/net/tuntap.sh
index 884e0ab..ac505ab 100644
--- a/net/tuntap.sh
+++ b/net/tuntap.sh
@@ -30,7 +30,7 @@ tuntap_pre_start()
local timeout=10
while [ ! -e /dev/net/tun -a ${timeout} -gt 0 ]; do
sleep 1
- timeout=$((${timeout} - 1))
+ : $(( timeout -= 1 ))
done
if [ ! -e /dev/net/tun ]; then
eerror "TUN/TAP support present but /dev/net/tun is not"
diff --git a/net/wpa_supplicant.sh b/net/wpa_supplicant.sh
index 91de49e..53b0256 100644
--- a/net/wpa_supplicant.sh
+++ b/net/wpa_supplicant.sh
@@ -34,7 +34,7 @@ _get_ssid()
return 0
fi
sleep 1
- timeout=$((timeout - 1))
+ : $(( timeout -= 1 ))
done
return 1
diff --git a/sh/functions.sh.in b/sh/functions.sh.in
index 1d1b0cd..b00ec68 100644
--- a/sh/functions.sh.in
+++ b/sh/functions.sh.in
@@ -8,14 +8,14 @@ RC_GOT_FUNCTIONS="yes"
eindent()
{
- EINFO_INDENT=$((${EINFO_INDENT:-0} + 2))
+ : $(( EINFO_INDENT = ${EINFO_INDENT:-0} + 2 ))
[ "$EINFO_INDENT" -gt 40 ] && EINFO_INDENT=40
export EINFO_INDENT
}
eoutdent()
{
- EINFO_INDENT=$((${EINFO_INDENT:-0} - 2))
+ : $(( EINFO_INDENT = ${EINFO_INDENT:-0} - 2 ))
[ "$EINFO_INDENT" -lt 0 ] && EINFO_INDENT=0
return 0
}
diff --git a/sh/rc-mount.sh b/sh/rc-mount.sh
index b3c9bf6..2bb1450 100644
--- a/sh/rc-mount.sh
+++ b/sh/rc-mount.sh
@@ -59,7 +59,7 @@ do_unmount()
eend 1
else
local sig="TERM"
- retry=$(($retry - 1))
+ : $(( retry -= 1 ))
[ $retry = 1 ] && sig="KILL"
fuser $f_kill$sig -k $f_opts \
"$mnt" >/dev/null 2>&1
diff --git a/sh/runtests.sh b/sh/runtests.sh
index 7f7e7bd..f083ff4 100755
--- a/sh/runtests.sh
+++ b/sh/runtests.sh
@@ -9,17 +9,17 @@ tret=0
ebegin "Testing yesno()"
for f in yes YES Yes true TRUE True 1 ; do
if ! yesno $f; then
- tret=$(($tret + 1))
+ : $(( tret += 1 ))
echo "!$f!"
fi
done
for f in no NO No false FALSE False 0 ; do
if yesno $f; then
- tret=$(($tret + 1))
+ : $(( tret += 1 ))
echo "!$f!"
fi
done
eend $tret
-ret=$(($ret + $tret))
+: $(( ret += $tret ))
exit $ret
diff --git a/src/test/runtests.sh b/src/test/runtests.sh
index 4731bd7..a4b3f18 100755
--- a/src/test/runtests.sh
+++ b/src/test/runtests.sh
@@ -15,7 +15,7 @@ checkit() {
echo "$@" | tr ' ' '\n' > ${base}.out
diff -u ${base}.list ${base}.out
eend $?
- ret=$(($ret + $?))
+ : $(( ret += $? ))
}
ret=0
@@ -65,7 +65,7 @@ readelf -Wr $(grep -l '#include[[:space:]]"librc\.h"' ${librc_srcdir}/*.c | sed
syms=$(diff -u librc.funcs.hidden.list librc.funcs.hidden.out | sed -n '/^+[^+]/s:^+::p')
[ -z "${syms}" ]
eend $? "Missing hidden defs:"$'\n'"${syms}"
-ret=$(($ret + $?))
+: $(( ret += $? ))
ebegin "Checking trailing whitespace in code"
# XXX: Should we check man pages too ?
@@ -118,7 +118,7 @@ for u in units/*; do
ebegin "$(basename "${u}")"
./"${u}"
eend $?
- ret=$(($ret + $?))
+ : $(( ret += $? ))
done
exit ${ret}
diff --git a/support/openvpn/up.sh b/support/openvpn/up.sh
index 1456932..c52ea04 100755
--- a/support/openvpn/up.sh
+++ b/support/openvpn/up.sh
@@ -34,7 +34,7 @@ while true; do
elif [ "${opt}" != "${opt#dhcp-option DNS *}" ]; then
NS="${NS}nameserver ${opt#dhcp-option DNS *}\n"
fi
- i=$((${i} + 1))
+ : $(( i += 1 ))
done
if [ -n "${NS}" ]; then