... in which case you probably want the IP address of the default route interface: Code: ip addr list dev `ip route list exact 0/0 | cut -d" " -f5` | \ sed -ne "s/^.*inet \([0-9.]*\).*$/\1/p"
ip addr list dev `ip route list exact 0/0 | cut -d" " -f5` | \ sed -ne "s/^.*inet \([0-9.]*\).*$/\1/p"