[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: ifconfig data



Hi Hugo,

this will give you the IP :)

ifconfig ppp0 | grep "inet addr:" | awk '{ print $2}' | tail -c14

probably not the best solution, (the last part awk .... assumes your IP has 14 chars) but this came to mind first .. do some experimenting :)


Hugo Vanwoerkom wrote:
Hi,

Ifconfig says:

...
ppp0      Link encap:Point-to-Point Protocol
inet addr:200.57.201.43 P-t-P:200.57.219.18 Mask:255.255.255.255
...

I want that inet addr (200.57.201.43) in a program and I prefer not to run the ifconfig command from it and grep it.

Does anyone know where else in the system that information resides?

I installed the net-tools source and looking at ifconfig.c it's not immediately obvious.

Hugo




Reply to: