sb_ipv4 (277B)
1 # gets ip information from the ip 2 # command and prints to stdout. 3 # requires interface name as the argument. 4 5 ipv4() { 6 IPV4="$(ip a show "${1:?}" 2>/dev/null | grep 'inet ' | sed 's/^.*inet //;s/\/.*$//')" 7 [ "$IPV4" ] && printf '%s: %s %s ' "$1" "$IPV4" "$DELIMITER" 8 }