[Perl] How to find IP address

Tzafrir Cohen tzafrir at technion.ac.il
Wed Oct 9 04:49:23 PDT 2002


On Wed, 9 Oct 2002, Oleg Kobets wrote:

> Thanks, that's exactly what I wanted. Simple and elegant.
>
> My bash script is simple:
>
> IP=`/sbin/ifconfig ppp0 | grep inet | awk '{print $2}' | sed 's#addr:##g'`
>
> send $IP
>
> When "send" is a perl program that simply uses Mail::Mailer to send me the
> IP.

'ip' may have an output that is easier to parse. It is part of the
'iproute' or 'iproute2' package.

Anyway, what's wrong with mail, mutt, and a host of other command-line
mailiers? (The two I mentioned require a local sendmail)

-- 
Tzafrir Cohen
mailto:tzafrir at technion.ac.il
http://www.technion.ac.il/~tzafrir





More information about the Perl mailing list