Last change
on this file since 38 was
38,
checked in by mitty, 14 years ago
|
|
-
Property svn:executable set to
*
|
File size:
355 bytes
|
Rev | Line | |
---|
[38] | 1 | #!/usr/bin/perl |
---|
| 2 | use strict; |
---|
| 3 | use Data::Dumper; |
---|
| 4 | |
---|
| 5 | my $interface; |
---|
| 6 | my %IPs; |
---|
| 7 | |
---|
| 8 | foreach ( qx{ (LC_ALL=C /sbin/ifconfig -a 2>&1) } ) { |
---|
| 9 | $interface = $1 if /^(\S+?):?\s/; |
---|
| 10 | next unless defined $interface; |
---|
| 11 | $IPs{$interface}->{STATE}=uc($1) if /\b(up|down)\b/i; |
---|
| 12 | $IPs{$interface}->{IP}=$1 if /inet\D+(\d+\.\d+\.\d+\.\d+)/i; |
---|
| 13 | } |
---|
| 14 | print Dumper(\%IPs); |
---|
Note: See
TracBrowser
for help on using the repository browser.