#!/usr/bin/perl -w use strict; my $from = "foo\@bar.com"; my $to = "bar\@foo.com"; my $subject = "Latest IP address"; my @ifc = `/sbin/ifconfig ppp0`; chomp ($_ = $ifc[1]); /inet\ addr:(\d+\.\d+\.\d+\.\d+)\s+.*$/; open (MAIL, "|/usr/lib/sendmail -oi -t -odq") || die "Can't fork for s +endmail: $!\n"; print MAIL "From: $from\nTo: $to\nSubject: $subject\n\n"; print MAIL $1; close (MAIL);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
•Don't use $1 without testing! (was Re: Getting the latest IP after dial-up)
by merlyn (Sage) on Aug 25, 2002 at 16:22 UTC | |
by barrd (Canon) on Aug 25, 2002 at 16:50 UTC | |
|
Re: Getting the latest IP after dial-up
by Mr. Muskrat (Canon) on Aug 25, 2002 at 17:00 UTC | |
by barrd (Canon) on Aug 25, 2002 at 17:10 UTC | |
by Mr. Muskrat (Canon) on Aug 25, 2002 at 17:15 UTC | |
by barrd (Canon) on Aug 25, 2002 at 17:30 UTC | |
by Anonymous Monk on Oct 09, 2002 at 12:05 UTC | |
by Mr. Muskrat (Canon) on Oct 09, 2002 at 13:37 UTC |