From: Daniel Lenski Date: Fri, 5 Feb 2021 23:20:15 +0000 (-0800) Subject: GNU awk regex fix X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=6eedd701a8aed8fa8b0f753b97bd0671bcc14891;p=users%2Fdwmw2%2Fvpnc-scripts.git GNU awk regex fix The character `#` does not need to be backslash-escaped in awk regexes, and GNU awk v5.1.0 complains about these regexes (first added in 3885f8bb). Fixes #17 Signed-off-by: Daniel Lenski --- diff --git a/vpnc-script b/vpnc-script index 7befb97..6839009 100755 --- a/vpnc-script +++ b/vpnc-script @@ -402,12 +402,12 @@ else # use route command # - keep lines starting with 'default' or '0.0.0.0', but exclude bogus routes '0.0.0.0/nn' where nn != 0 # - remove lines containing IPv6 addresses (':') # - remove lines for link-local routes (https://superuser.com/a/1067742) - netstat -r -n | awk '/:/ { next; } /link\#/ { next; } /^(default|0\.0\.0\.0([[:space:]]|\/0))/ { print $2; exit; }' + netstat -r -n | awk '/:/ { next; } /link#/ { next; } /^(default|0\.0\.0\.0([[:space:]]|\/0))/ { print $2; exit; }' } get_default_gw_excl_tunnel() { # Get rid of lines containing $TUNDEV (we don't want loopback) - netstat -r -n | awk '/:/ { next; } /link\#/ { next; } /[[:space:]]'"$TUNDEV"'([[:space:]]|$)/ { next; } /^(default|0\.0\.0\.0([[:space:]]|\/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() {