Advertisement
hiro1357

getip.pl

Jul 9th, 2014
275
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.22 KB | None | 0 0
  1. #!/usr/bin/perl
  2.  
  3. #my $in = <STDIN>;
  4. my $in = `ip addr`;
  5. my @eth = split(/$ARGV[0]/, $in);
  6. my @delnext = split(/: /, $eth[1]);
  7. my @inet = split(/inet /, $delnext[1]);
  8. my @addr = split(/\//, $inet[1]);
  9.  
  10. print $addr[0];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement