Joe Van Dyk <joevandyk / gmail.com> writes:

> Hi,
>
> Other than parsing the output of `sudo /sbin/ifconfig`, anyone know of
> a way to get the current IP address of a NIC?  (say, eth0).
>
> Thanks!
> Joe

Parsing ifconfig is the only method that works on the largest number
of OSes.

Other than that, you'd have to use OS-dependent feature like what
Detlef Reichl has shown.

YS.