The Perl script that contains a Unix command to grep the ethernet NICs cannot be executed within the script! I have tried "qx" , $var and "system" but it does not seem to work!
The codes:
#!/usr/bin/perl
use warnings;
use strict;
use Term::ANSIColor;
print "\nYou are now in Showing Ethernet Cards!\n\n";
print "**************************\n";
print "|Ethernet Cards Available|\n";
print "**************************\n";
print "\nThe Ethernet Cards that are available are: ";
my $ex = system ('ifconfig | awk '{print $1}' | egrep "eth|lo"');
print "$ex";
When executed the error "syntax error at ./ethercards.pl line 14, near "'ifconfig | awk '{" Execution of ./ethercards.pl aborted due to compilation errors." shows up in the terminal.
Does anyone have any thoughts on this? Thanks!