Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^2: Net::OpenSSH multiple commands

by salva (Abbot)
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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1027393]
help
Chatterbox?
[ambrus]: Like <c>{ package AnyEvent::Impl:: Prima; use Prima; sub io{ my($s,%r)=@_; Prima::File->new( file=>$r{fh},mask =>("w"eq$r{poll}? fe::Write():fe:: Read())|fe:: Exception,onRead =>$r{cb},onWrite =>$r{cb}, onException=>$r{cb }) } sub timer { ... } push @AnyEvent::REGI
[ambrus]: argh, too long, let me try on scratchpad
[Corion]: . o O ( I seem to have improved my skills of getting other people to write code for me )
[ambrus]: ambrus's scratchpad
[ambrus]: Also, I was wrong, apparently you have to support both periodic and one-shot timers in an AnyEvent backend
[Corion]: ambrus: That looks deceptively simple, but maybe that's simply all that's needed. Which would be great! I hope I get to test it tomorrow, thanks!!

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (9)
As of 2016-12-08 12:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (141 votes). Check out past polls.