Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: how do I find my IP address
- X-seq: zsh-users 7542
- From: Jussi Pakkanen <jpakkane@xxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: how do I find my IP address
- Date: Mon, 14 Jun 2004 03:58:20 -0700 (PDT)
- In-reply-to: <20040613233708.A28043@xxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
--- Jason Price <jprice@xxxxxxxxxxxxxxxxxxxx> wrote:
> On most unix flavors, some varient of:
>
> ifconfig -a | grep inet | grep -v '127.0.0.1' | awk
> '{print $2}'
>
> should work. 'ifconfig' can live in various places,
> but usually it
> is in /sbin/ifconfig or /usr/sbin/ifconfig (old
> unixen might have it in /etc/ifconfig).
> I'm sure there's a way to figure out a pure zsh way
> to do this, but I don't know it.
The purest I could think of was eliminating awk, which
can be done like this:
foo=`ifconfig | grep inet | grep -v '127.0.0.1'`
baz=($=foo)
Now $baz[2] contains the ip address. I guess you could
get the address by poking /proc, but that's not very portable.
__________________________________
Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/
Messages sorted by:
Reverse Date,
Date,
Thread,
Author