Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^3: Command Executing problem in perl.

by mantager (Sexton)
on Jun 28, 2012 at 07:15 UTC ( [id://978846]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Command Executing problem in perl.
in thread Command Executing problem in perl.

Hi leslie.
Creating the file on the remote machine is not impossible, it's only a matter of quoting the string the right way.
In your case, it's also a matter of isolating that > sign you have inside your parameters, because otherwise it's interpreted by the remote shell as a redirection.

With this:

my @cmd = ( 'ssh', '-x', $remotehost, q['mminfo -q "savetime>3/1/12,name=DISASTER_RECOVERY:\\\\" -av -ot + -r client > /home/rbr/clnts'] ); print qx/@cmd/;
you should get the result you expect. I assumed the \ after the colon is just one, because if you launch directly the command:
mminfo -q "savetime>3/1/12,name=DISASTER_RECOVERY:\\" \ -av -ot -r client >/home/rbr/clnts
from the shell, one of the \ is eaten by the shell. The four \\\\ should be equivalent. I tried this with a "mminfo" command that is just a script echoing its arguments, and this is what I get:
-q savetime>3/1/12,name=DISASTER_RECOVERY:\ -av -ot -r client
and it's written in a file on the remote machine.

Cheers.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://978846]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (3)
As of 2024-04-24 03:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found