From: Nicolas Boisselier Date: Thu, 27 Jun 2019 14:20:44 +0000 (+0100) Subject: etc/profile.d/net.sh X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=de718772e815d29867d6fd6362da4ed2a87b5bd4;p=nb.git etc/profile.d/net.sh --- diff --git a/etc/profile.d/net.sh b/etc/profile.d/net.sh index cedcff9c..106d6dfb 100644 --- a/etc/profile.d/net.sh +++ b/etc/profile.d/net.sh @@ -50,7 +50,7 @@ net_mask2cdr() { echo $(( $2 + (${#x}/4) )) } -net_host_ip() { +net_resolve_ip() { host -s "$1" | awk '/has address/{print $4; exit}' } @@ -58,7 +58,7 @@ net_is_local() { declare ip="${1:?Usage: net_is_local IP|HOST}" case "$ip" in [0-9][0-9]?[0-9]?.[0-9][0-9]?[0-9]?.[0-9][0-9]?[0-9]?.[0-9][0-9]?[0-9]?) [ 1 ];; - *) ip="$(net_host_ip "$ip")" + *) ip="$(net_resolve_ip "$ip")" esac [ -n "$ip" ] || return 2