From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1376 invoked from network); 14 Jun 2004 10:59:52 -0000 Received: from thor.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.86) by ns1.primenet.com.au with SMTP; 14 Jun 2004 10:59:52 -0000 Received: (qmail 20603 invoked from network); 14 Jun 2004 10:59:15 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 14 Jun 2004 10:59:15 -0000 Received: (qmail 9710 invoked by alias); 14 Jun 2004 10:58:54 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7542 Received: (qmail 9700 invoked from network); 14 Jun 2004 10:58:54 -0000 Received: from thor.dotsrc.org (HELO a.mx.sunsite.dk) (qmailr@130.225.247.86) by sunsite.dk with SMTP; 14 Jun 2004 10:58:51 -0000 Received: (qmail 19861 invoked from network); 14 Jun 2004 10:58:50 -0000 Received: from web40303.mail.yahoo.com (66.218.78.82) by a.mx.sunsite.dk with SMTP; 14 Jun 2004 10:58:49 -0000 Message-ID: <20040614105820.62157.qmail@web40303.mail.yahoo.com> Received: from [130.233.173.8] by web40303.mail.yahoo.com via HTTP; Mon, 14 Jun 2004 03:58:20 PDT Date: Mon, 14 Jun 2004 03:58:20 -0700 (PDT) From: Jussi Pakkanen Subject: Re: how do I find my IP address To: zsh-users@sunsite.dk In-Reply-To: <20040613233708.A28043@redfish.gatech.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, hits=-0.9 required=6.0 tests=BAYES_10 autolearn=no version=2.63 X-Spam-Hits: -0.9 --- Jason Price 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/