Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^3: Command Executing problem in perl.

by mantager (Sexton)
on Jun 28, 2012 at 07:15 UTC ( #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.


Comment on Re^3: Command Executing problem in perl.
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (11)
As of 2014-09-19 09:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (134 votes), past polls