extract IP address and feed it into a command

DJ Boris dj_boris at mail.ru
Mon Apr 28 14:59:24 PDT 2003


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




More information about the freebsd-questions mailing list