From aae6d73c432791a17e0430f05a1edd44d1db0620 Mon Sep 17 00:00:00 2001 From: Joe Cooper Date: Wed, 5 Sep 2018 21:13:32 -0500 Subject: [PATCH] Only get one address, even if there are multiple --- slib.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slib.sh b/slib.sh index 7265e06..1c25dde 100644 --- a/slib.sh +++ b/slib.sh @@ -431,7 +431,7 @@ setconfig () { # works across most Linux and FreeBSD (maybe) detect_ip () { defaultdev=$(ip ro ls|grep default|awk '{print $5}') - primaryaddr=$(ip -f inet addr show dev "$defaultdev"|grep 'inet '|awk '{print $2}'| cut -d"/" -f1) + primaryaddr=$(ip -f inet addr show dev "$defaultdev" | grep 'inet ' | awk '{print $2}' | cut -d"/" -f1 | cut -f1) if [ "$primaryaddr" ]; then log_debug "Primary address detected as $primaryaddr" address=$primaryaddr