Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 08-27-2004, 11:49 PM   #1
Registered: Jun 2003
Location: Denver, CO
Distribution: Debian
Posts: 95

Rep: Reputation: 15
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.
Old 08-28-2004, 02:00 AM   #2
Senior Member
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
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.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to pass command-line parameter to shell script? Kropotkin Linux - Newbie 12 07-25-2011 09:24 AM
How to execute a command line in a shell script orgazmo Programming 5 05-09-2005 09:16 AM
PERL script OK at command line, not in browser alvo Programming 4 12-19-2004 08:28 AM
shell script works form command line but not form crontab saifee General 1 10-14-2004 10:27 AM
Shell Script to read 500files from the command line saravanan1979 Programming 1 09-22-2004 09:44 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:50 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration