Help with syntax

I am trying to get a command to run but I keep getting errors.
The command is to update fp2000 server extensions -> fpsrvadm.exe. I have had it running with errors but working OK.
Anyway here goes...I am using the syntax....

exec fpsrvadm.exe `-o install -t $server -s /path/to/httpd.conf -p 80 -m hostname -u fplogin -pw fppasswd -xu unix_user_name -xg unix_group`;

This is all typed in one line. Is there another way of doing this? Sometimes I get an error about using system instead of exec. But if I change it still doesn't work.
Who is Participating?
This is in PERL?

IF so, then your back quotes are the problem.


exec "fpsrvadm.exe -o ...."

If you give the string you typed to PERL I would expect that `-o... ` would be executed with -o as the command, and the results concatenated with "fpsrvadm.exe" as a string and then THAT gets executed. Which is not what you wanted.

Remember that ` is kind of a shortcut of "system", so you are typing:

exec fpsrvadm.exe system("-o...")

j1mlondonAuthor Commented:
It didn't work. In fact it gave me more errors than before!
What errors do you get when you try
exec "fpsrvadm.exe -o install -t $server -s /path/to/httpd.conf -p 80 -m hostname -u fplogin -pw fppasswd -xu unix_user_name -xg unix_group";
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

How about using system instead of exec?  exec doesn't return anything so the calling program doesn't know whether the command was executed successfully.

Try the following, assuming that a false return indicates a failure and display an appropriate message.

my $command = 'fpsrvadm.exe -o install -t $server -s /path/to/httpd.conf -p 80 -m hostname -u fplogin -pw fppasswd -xu unix_user_name -xg unix_group';

    die "$command did not execute successfully\n$!\n";

j1mlondonAuthor Commented:
The error message is..
Statement unlikely to be reached at line 18.
      (Maybe you meant system() when you said exec()?)
Can't exec "
Starting ":No such file or directory at line 17, <FP> chunk 3.

Sometimes it works even with the errors and sometimes not at all.???

j1mlondonAuthor Commented:
Thanks Mick,
I tried that also. No errors..BUT it hangs and doesn't complete the command to update the server which is what initially happened ( from my hazy memory) when I tried using system instead of exec.
I changed to exec and it works but doesn't pass the args to the command.
Could I use some sort of pipe to pipe the args into the command?
Is fpsrvadm.exe in your PATH?
j1mlondonAuthor Commented:
j1mlondonAuthor Commented:
And alias is set also for fpsrvadm = fpsrvadm.exe
Sorry, I just took a look at the code I presented and $server is in single quotes.  It won't interpolate here and that may be causing some problems.  ( I hope you noticed this before me) .  :-)

It may be worth looking at the man page for


perldoc Shell

to see the documentation if the module is on your system.
j1mlondonAuthor Commented:
Yes I noticed that. Do you mean that the variables won't be used it will use the literal contents of whats between the quotes?
back quotes (`) interpolate and execute
single quote (') does not interpolate, makes a string
double quote (") interpolates.

$x = '/';       # assign a / to $x
print `ls $x`;  # prints results of running ls /
print 'ls $x';  # prints "ls $x"
print "ls $x";  # prints "ls /"

EXEC replaces the current process with the NEW process

SYSTEM runs the new process separately and returns a result code to the new process.

backquote (`) is like system. runs the process and returns a result code. But the stuff that normally would go to the screen is re-directed as a result of the execution. The "result code" is in a system variable.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.