Another possibility that directly gives the right result and uses ifconfig:
$ ifconfig | grep 'inet '| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'
That said, I don't know if the "inet" string stays the same in every locale, though.
Another possibility that directly gives the right result and uses ifconfig:
$ ifconfig | grep 'inet '| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'
That said, I don't know if the "inet" string stays the same in every locale, though.