Re: How to determine local IP
What about this one??
ifconfig | \
grep "inet addr" | \
grep -v "127.0.0.1" | \
awk '{print $2;}' | \
awk -F':' '{print $2;}'
On Mon, Jun 21, 1999 at 11:23:29PM -0500, R. Brock Lynn wrote:
> scratch wrote:
> >
> > 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/);'
>
> oohh nifty. Now let's see if I can figure out how it works. :)
> (no don't tell me now! I took the usenix perl tutorials... I should know... :\
>
> --Brock
>
> --------------------- PGP key ID: FED76A3D <brock@cyberdude.com> 4 / 5 / 1999
>
> __ _ Debian GNU R. Brock Lynn <brock@nettronix.net>
> / /(_)_ __ _ ___ __ http://www.debian.org/ irc.openprojects.net
> / / | | '_ \| | | \ \/ / 'Free Software'
> / /__| | | | | |_| |> < Remember that's "Free" as in Freedom, not "Free" as
> \____/_|_| |_|\__,_/_/\_\ in price! Debian's the Greatest!
>
>
> --
> Unsubscribe? mail -s unsubscribe debian-user-request@lists.debian.org < /dev/null
>
>
--
____________________________________________________________________________
Shao Zhang - Running Debian 2.1 ___ _ _____
Department of Communications / __| |_ __ _ ___ |_ / |_ __ _ _ _ __ _
University of New South Wales \__ \ ' \/ _` / _ \ / /| ' \/ _` | ' \/ _` |
Sydney, Australia |___/_||_\__,_\___/ /___|_||_\__,_|_||_\__, |
Email: shao@cia.com.au |___/
_____________________________________________________________________________
Reply to: