Skip to content

Commit

Permalink
Only get one address, even if there are multiple
Browse files Browse the repository at this point in the history
  • Loading branch information
swelljoe committed Sep 6, 2018
1 parent 2a3739c commit aae6d73
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion slib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit aae6d73

Please sign in to comment.