I've found lots of ways to use similar Perl ssh
modules to capture ssh
command line output (e.g. Net::SSH::Perl
) but not how to do this with Net::Perl
, which is what I want because it is packaged in Debian.
I found an example which shows some usage of Net::Perl
but not enough for this novice to run ls -1
on a remote system and send the output to my console, but I want to capture the output in a @list
:
use Net::SSH qw(ssh issh sshopen2 sshopen3);
ssh('user@hostname', $command);
issh('user@hostname', $command);
ssh_cmd('user@hostname', $command);
ssh_cmd( {
user => 'user',
host => 'host.name',
command => 'command',
args => [ '-arg1', '-arg2' ],
stdin_string => "string\n",
} );
sshopen2('user@hostname', $reader, $writer, $command);
sshopen3('user@hostname', $writer, $reader, $error, $command);
Since you didn't say anything about being interactive, all you need is
Or if you want to capture both STDOUT and STDERR,