]> www.infradead.org Git - users/dwmw2/vpnc-scripts.git/commitdiff
Use '[[:space:]]' instead of '\s' to support POSIX awk
authorAaron LI <aly@aaronly.me>
Sun, 13 Dec 2020 08:45:45 +0000 (16:45 +0800)
committerDaniel Lenski <dlenski@gmail.com>
Thu, 17 Dec 2020 00:26:19 +0000 (16:26 -0800)
The `\s` is a GNU extension to awk and doesn't work on BSD's awk.  Use
`[[:space:]]` instead to work with BSD's awk.

Signed-off-by: Aaron LI <aly@aaronly.me>
vpnc-script

index 33286816b75665b5da319c7fafdb906fc3c2cff3..7c52fdd20916f67bf02e56e25e392f713096fc8a 100755 (executable)
@@ -400,7 +400,7 @@ else # use route command
                # Get rid of lines containing IPv6 addresses (':')
                # Get rid of lines for link-local routes (https://superuser.com/a/1067742)
                # Get rid of lines containing $TUNDEV (we don't want loopback)
-               netstat -r -n | awk '/:/ { next; } /link\#/ { next; } /\s'"$TUNDEV"'(\s|$)/ { next; } /^(default|0\.0\.0\.0(\s|\/0))/ { print $2; exit; }'
+               netstat -r -n | awk '/:/ { next; } /link\#/ { next; } /[[:space:]]'"$TUNDEV"'([[:space:]]|$)/ { next; } /^(default|0\.0\.0\.0([[:space:]]|\/0))/ { print $2; exit; }'
        }
 
        set_vpngateway_route() {