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

Re: How to determine local IP



On Mon, 21 Jun 1999, R. Brock Lynn wrote:

> > /sbin/ifconfig | grep P-t-P | cut -d: -f2 | cut -d" " -f1
> 
> nice, now can you do that with a perl one-liner? :)

Something like this?
perl -e 'print (`/sbin/ifconfig` =~ /inet addr:(.*?)\s/);'

--nico ;) 

(yeah you'll probably have to change 'inet addr' to 'P-t-P')

:: Nico Galoppo ::  Linux - Free power for the masses  :  ::  :::::.
                ::                                                 ::
                ::  scratch at ace.ulyssis.student.kuleuven.ac.be  ::
                 :                 http://hq.narfum.org/~scratch  ::
                   .                                           .::


Reply to: