in reply to perl -e in ssh
You need to add an extra level of quoting resulting in...
Or you can use Net::OpenSSH and forget about this quoting nightmare:'perl\\ -e\\ \\\'\\$s\\ \\=\\ shift\\;\\ \\$SIG\\{ALRM\\}\\ \\=\\ sub\ +\ \\{\\ kill\\ INT\\ \\=\\>\\ \\$p\\ \\}\\;\\ exec\\(\\@ARGV\\)\\ unl +ess\\ \\$p\\ \\=\\ fork\\;\\ alarm\\ \\$s\\;\\ waitpid\\ \\+\\$p\\,\\ + 0\\ \\\'\\ 3\\ \\\'ls\\ -ltr\\\''
And check also GRID::Machine, that allows to run perl code in remote machines through SSH.use Net::OpenSSH; my $ssh=Net::OpenSSH->new($server); my $line = $ssh->capture(perl => -e => <<'EOC', 3, 'ls -ltr'); $s = shift; $SIG{ALRM} = sub {kill INT => $p}; exec(@ARGV) unless $p = fork; alarm $s; waitpid $p, 0; EOC
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: perl -e in ssh
by ikegami (Patriarch) on Apr 13, 2010 at 17:59 UTC | |
by Anonymous Monk on Apr 13, 2010 at 18:42 UTC | |
by Anonymous Monk on Apr 13, 2010 at 19:05 UTC | |
by Anonymous Monk on Apr 13, 2010 at 19:06 UTC | |
by ikegami (Patriarch) on Apr 13, 2010 at 19:22 UTC | |
|
Re^2: perl -e in ssh
by Anonymous Monk on Apr 13, 2010 at 17:46 UTC |