#!/bin/sh # Usage: addr [<if>] # Show IPv4 address for interface <if> or all interfaces with # no <if> given. # Darwin/OSX ifconfig -a | grep 'inet ' | grep broadcast | awk '{ print $2 }' # Linux ifconfig -a | grep 'inet ' | grep Bcast | awk '{ print $2 }'