Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^2: Net::OpenSSH multiple commands

by salva (Monsignor)
on Apr 07, 2013 at 20:06 UTC ( #1027393=note: print w/ replies, xml ) Need Help??


in reply to Re: Net::OpenSSH multiple commands
in thread Net::OpenSSH multiple commands

It is recommendable to let Net::OpenSSH quote the command arguments. Double references can be used to let some fragment pass unquoted:

my @cmd1 = (cd => $path_to_file); my @cmd2 = (ls => '-a'); $ssh->system(@cmd1, \\'&&', @cmd2)
Otherwise, in case $path_to_file contained shell metacharacters it could produce undesired results or even be a security hole.

Note that currently, argument quoting expect some derivative of the Bourne shell on the remote side. Support for quoting arguments for other shells is in the works though.


Comment on Re^2: Net::OpenSSH multiple commands
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (11)
As of 2014-10-23 16:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (126 votes), past polls