in reply to Re^2: safely passing args through ssh
in thread safely passing args through ssh
That doesn't look anything like what I wrote. I showed how to contruct a shell command to pass to ssh but you passed 5 arguments after the target, none of which a shell command.
If you call ssh twice, you have two shell commands to build.
sub text_to_shell_lit(_) { return $_[0] if $_[0] =~ /^[a-zA-Z0-9_\-]+\z/; my $s = $_[0]; $s =~ s/'/'\\''/g; return "'$s'"; } my $very_remote_cmd = join ' ', map text_to_shell_lit, argcount => ( 'a b c' ); my $remote_cmd = join ' ', map text_to_shell_lit, ssh => ( '--', $very_remote_target, $very_remote_cmd ); backticks(ssh => ( '--', $remote_target, $remote_cmd ));
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: safely passing args through ssh
by perl5ever (Pilgrim) on Jul 25, 2011 at 23:02 UTC | |
by ikegami (Patriarch) on Jul 25, 2011 at 23:29 UTC | |
by perl5ever (Pilgrim) on Jul 26, 2011 at 14:56 UTC | |
by ikegami (Patriarch) on Jul 26, 2011 at 18:03 UTC |