Perl shell-out to script dunna work. Works on command line. Why?
I've got a perl script which executes:
my $retval = `sudo /usr/bin/firewall`;
... and comes back with a bunch of errors. First is:
/sbin/ipchains: host/network `-j' not found
If I run 'sudo /usr/bin/firewall' at the bash prompt, no problem. No errors.
This is the line in my bash script which works when launched at the command prompt, but not with launched perl backticks:
/sbin/ipchains -A input -i $LOOPBACK_INTERFACE -j ACCEPT
Any help greatly appreciated.
My guess is that somewhere there's an environment variable or four that is set when you run in an interactive shell and is not set when you run as a shell script. An obvious first candidate is this $LOOPBACK_INTERFACE -- where is this variable set? Maybe print it out to be sure it's being set correctly. You can also try having Perl exec the script in debug mode (bash --debug <script>) and go through and examine the state of things to figure out where the problem is.
|All times are GMT -5. The time now is 01:15 AM.|