From: Aaron LI Date: Sun, 13 Dec 2020 08:45:45 +0000 (+0800) Subject: Use '[[:space:]]' instead of '\s' to support POSIX awk X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=cda6e65688a691707744b99eeabef1d0804171cf;p=users%2Fdwmw2%2Fvpnc-scripts.git Use '[[:space:]]' instead of '\s' to support POSIX awk 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 --- diff --git a/vpnc-script b/vpnc-script index 3328681..7c52fdd 100755 --- a/vpnc-script +++ b/vpnc-script @@ -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() {