Forum Moderators: coopster & phranque

Message Too Old, No Replies

Run Shell COmmand in Perl SCript

         

carfac

10:31 pm on May 30, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi:

I need to run a shell command from a perl script. I found this:

[kobesearch.cpan.org...]

but I can't seem to get it to work. What I want to do is insert an IP address into ipfw... I want to run:

/sbin/ipfw add 25002 deny ip from $ip to any;

where $ip is a variable.

Any ideas?

Thanks!

Dave

zCat

10:53 pm on May 30, 2006 (gmt 0)

10+ Year Member



The simple way, assuming your input can be trusted:

$cmd = "/sbin/ipfw add 25002 deny ip from $ip to any";
system $cmd;
# or alternatively
qx/$cmd/;