Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

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.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://978846]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (8)
As of 2017-07-26 21:11 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (402 votes). Check out past polls.