From owner-freebsd-questions@FreeBSD.ORG Mon Apr 28 15:36:23 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0969637B401 for ; Mon, 28 Apr 2003 15:36:23 -0700 (PDT) Received: from uccinc.net (ns1.uccinc.net [216.161.174.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id 560F343FBD for ; Mon, 28 Apr 2003 15:36:22 -0700 (PDT) (envelope-from tom@openadventures.org) Received: from openadventures.org (ns3.uccinet.net [216.161.174.4]) by uccinc.net (8.11.6/linuxconf) with ESMTP id h3SMZF805640; Mon, 28 Apr 2003 15:35:15 -0700 Message-ID: <3EADAC96.6020601@openadventures.org> Date: Mon, 28 Apr 2003 15:35:02 -0700 From: Tom Smith User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.2) Gecko/20030208 Netscape/7.02 X-Accept-Language: en-us, en MIME-Version: 1.0 To: DJ Boris References: <01de01c30dd1$5c5d4c10$6300a8c0@fmelectro.co.za> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-MailScanner: Found to be clean cc: freebsd-questions Subject: Re: extract IP address and feed it into a command X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Apr 2003 22:36:23 -0000 This is taken from a Linux firewall script I use to determine a Dynamic IP address. In this case, $IFCONFIG, $EXTIF, and $AWK are defined as variables. For reference, IFCONFIG=/sbin/ifconfig, EXTIF=eth0, AWK=/bin/awk. EXTIP="`$IFCONFIG $EXTIF | $AWK $EXTIF/'{next}//{split($0,a,":");split(a[2],a," ");print a[1];exit}'`" I didn't write this script so I don't fully understand what it's doing but maybe it'll lead you in the right direction. DJ Boris wrote: >hi there, > >I am running fBSD 4.7 release. > >I need to extract my IP address which is dynamically assigned by my ISP and >feed it into a serialmail command > >"maildirsmtp ~alias/pppdir alias-ppp- 1.2.3.4 `hostname` " > >which is executed from my ppp.linkup. > >I have to replace hostname with my dynamic IP. > >I know that my IP always starts with zzz.zzz and if I run > >"ifconfig | grep zzz.zzz" > >I get > >inet zzz.zzz.xxx.xxx --> yyy.yyy.yyy.yyy netmask nnnnnnnnnn > >Is there a command or something else that I can use in order to get only the >IP starting with zzz.zzz up to the first space and how do I feed it into the >above command? > >thanx >dj boris > > >_______________________________________________ >freebsd-questions@freebsd.org mailing list >http://lists.freebsd.org/mailman/listinfo/freebsd-questions >To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org" > >