commit:     b862d25a8ad39d79fdb4564447f1bb8cd33cb6bf
Author:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 21 05:17:25 2019 +0000
Commit:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Sun Apr 21 05:17:25 2019 +0000
URL:        https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=b862d25a

sh/udhcpc-hook.sh: shellcheck fixes

Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>

 sh/udhcpc-hook.sh.in | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/sh/udhcpc-hook.sh.in b/sh/udhcpc-hook.sh.in
index 13ea336..e4300c1 100644
--- a/sh/udhcpc-hook.sh.in
+++ b/sh/udhcpc-hook.sh.in
@@ -68,7 +68,7 @@ update_classless_routes()
                max_routes=128
                metric=
                [ -n "${IF_METRIC}" ] && metric="metric ${IF_METRIC}"
-               while [ -n "$1" -a -n "$2" -a $max_routes -gt 0 ]; do
+               while [ -n "$1" ] && [ -n "$2" ] && [ $max_routes -gt 0 ]; do
                        gw_arg=
                        if [ "$2" != '0.0.0.0' ]; then
                                gw_arg="gw $2"
@@ -76,7 +76,7 @@ update_classless_routes()
 
                        [ ${1##*/} -eq 32 ] && type=host || type=net
                        route add -$type "$1" ${gw_arg} ${metric} dev 
"${interface}"
-                       max=$(($max-1))
+                       max=$((max-1))
                        shift 2
                done
        fi
@@ -90,7 +90,7 @@ update_routes()
 
        # If the DHCP server returns both a Classless Static Routes option and
        # a Router option, the DHCP client MUST ignore the Router option.
-       if [ -n "${router}" -a -z "${staticroutes}" ] ; then
+       if [ -n "${router}" ] && [ -z "${staticroutes}" ] ; then
                metric=
                [ -n "${IF_METRIC}" ] && metric="metric ${IF_METRIC}"
                for i in ${router} ; do
@@ -115,6 +115,7 @@ deconfig()
 }
 
 if [ -r "/run/udhcpc-${interface}.conf" ]; then
+       # shellcheck disable=SC1090
        . "/run/udhcpc-${interface}.conf"
 fi
 

Reply via email to