Getting IP in a script

Kevin Buettner kev@primenet.com
Tue, 13 Mar 2001 14:32:15 -0700


On Mar 13, 12:06pm, Lucas Vogel wrote:

> To find that glibc call, would it help to look in the sources of the
> ifconfig program? I'm curious as to the process of finding the appropriate
> function call here...

Yes, looking at the source to ifconfig (or using strace on ifconfig as
Deepak did) is often the quickest way to find something like this out.

Actually, before I looked at the ifconfig sources, I poked around
/proc for a while thinking the information would be there.  If
it's there, I didn't see it.  I think it'd be handy to have (e.g.) a
/proc/net/devs/eth0 which would provide you with this information.

The strange thing is that there is a /proc/net/dev which lists the
interfaces and certain statistics.

Kevin