diff options
author | Mike Frysinger <vapier@gentoo.org> | 2011-11-10 21:46:08 -0500 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2011-11-19 02:25:36 -0500 |
commit | ef1ff1b4f29762d1caf83dc2b65ccfc7cb96e140 (patch) | |
tree | f1ebb65eec6eb156a0fba737bcd5386af2a9ebfe /init.d/net.lo.in | |
parent | 0510c473d4cd9097401e3a7bc236b0121977b81d (diff) |
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>
Diffstat (limited to 'init.d/net.lo.in')
-rw-r--r-- | init.d/net.lo.in | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/init.d/net.lo.in b/init.d/net.lo.in index 66e19456..d647f319 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 |