udhcpc: tweak math shell style with the metric var
authorMike Frysinger <vapier@gentoo.org>
Wed, 27 Feb 2013 06:05:34 +0000 (01:05 -0500)
committerMike Frysinger <vapier@gentoo.org>
Wed, 27 Feb 2013 06:05:34 +0000 (01:05 -0500)
Some shells (like dash) are lame and omit the POSIX increment/decrement
feature (because it is listed as optional).  Tweak the shell script to
work in all POSIX variants.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
examples/udhcp/simple.script

index d42f2d3d5bcefc5d4a3ae670db2544f572fcc676..0397e506c60a8db1b7e9b41695866e1a29d9cfdd 100755 (executable)
@@ -29,7 +29,8 @@ case "$1" in
                        metric=0
                        for i in $router ; do
                                echo "Adding router $i"
-                               route add default gw $i dev $interface metric $((metric++))
+                               route add default gw $i dev $interface metric $metric
+                               : $(( metric += 1 ))
                        done
                fi