Hi,
> > If I change the system line in the script (below) and paste the single
> > line output to the shell all works fine.
>> What do you mean exactly ? Does the perl script not actually run the
> expect
> script /root/grab\-config for you?
>> Well, you're escaping too much ... the first thing to figure
> out is if the expect script is actually getting called at all. the next
> thing to look at is how you've split up the arguments to system ...
from the perldoc page for system():
system LIST
system PROGRAM LIST
... If there is more than one argument in LIST, or if LIST is an
array with more than one value, starts the program given by the
first element of the list with arguments given by the rest of
the list. If there is only one scalar argument, the argument is
checked for shell metacharacters, and if there are any, the
entire argument is passed to the system’s command shell ...
You've passed a list to system() so the first argument,
"/root/grab\-config ", is executed directly, with subsequent arguments
to system() being passed to tht program (or expect script, whatever).
The shell doesn't get a chance to parse the argument.
The backslash in the argument doesn't seem to upset perl, but the
trailing space does - remove that and see if your problems are solved.
As Niall pointed out, you could probably join the arguments together as
a single string before calling system() with that single argument. Then
the shell would get to parse the line, and would probably get it right.
Personally I'd try to avoid the shell though, unless you specifically
want it to parse the line.
hth,
-KOR
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!