begin quoting John H. Robinson, IV as of Fri, Dec 22, 2006 at 09:46:23AM -0800:
[snip]
> That RE is a lot easier to read, IMHO than trying to match an exact IP
> address. This is what I came up with:
>
> #!/usr/bin/perl -T -w
>
> $ENV{PATH}="";
>
> $ifc=qx(/sbin/ifconfig eth0);
>
> if ($ifc =~ m/inet addr:([^ ]*)/) {
> print "$1\n";
> } else {
> print "No match.\n"
> }
>
> exit 0;
>
> __END__
>
> Comment to suit your needs.
[snip]
Surely you'd want to exit with 0 or 1, depending on a match
or not, so that you can more easily use your script in another,
yes?
--
_ |\_
\|
--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg