What's my IP Address?
Bash + curl + iproute2, 54 50 49 48 33 bytes
ip r g 1|awk '$0=$7'
curl eth0.me
Thanks @DomHastings for golfing off 1 byte!
Thanks @Sisyphus for coming up with a shorter URL!
Thanks @zeppelin for golfing off 9 bytes!
Bash 37 31 27 bytes
This is inspired by the answer by Bruce Forte. That answer only works with IPv4 which means it doesn't work for me. I have rewritten it into a version that (only) works with IPv6:
ip r g b::|awk '$0=$9" "$9'
This is tested on Ubuntu 14.04.5 connected through PPPoE and since IPv6 is designed to be used without any NAT it will output the same IP address twice.
-6 bytes thanks to zeppelin, -2 bytes thanks to Ferrybig, -2 bytes thanks to Markasoftware.
AutoIt, 56 53 bytes
#include<Inet.au3>
ConsoleWrite(@IPAddress1&_GetIP())
@IPAddress1
is a macro that returns
IP address of first network adapter
_GetIP()
returns
the public IP address.
-3 bytes thanks to @mınxomaτ