Forum Moderators: phranque

Message Too Old, No Replies

Add shell statement to a perl script

         

carfac

4:43 pm on May 7, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi:

ANyone have any idea how to have a running perl script send a command directly to shell? Not sure if that is exactly what I mean... I have a statement I usually run in telnet on my machine, and I want to have a perl script run it. the command is:

/sbin/ipfw add 11001 deny all from $ip to any;

How would I do that?

Thanks!

Dave

carfac

5:11 pm on May 7, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



OK, I figured out part of the problem. The perl script runs with the first line: #!/usr/bin/perl

I could run the ipfw command directly if that first line was #!/bin/sh

so what I need to know if how to get to the "shell"mode to run one line in the code. I probably am saying that wrong, but that is the idea here.

Oh, this is FreeBSD...

Thanks!

Dave

jdMorgan

12:14 am on May 8, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I use this to update time stamps from PERL:

system("/usr/bin/touch",$tstfile);

So, system("path_to_your_shell_command"); should work.

Jim

carfac

2:51 am on May 8, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



thanks Jim!