Véase Net::SSH::Expect:
casiano@beowulf:~$ pp2@nereida:~/src/testing$ cat -n netsshexpect.pl 1 #!/usr/bin/perl -w 2 use strict; 3 use Net::SSH::Expect; 4 5 my $host="xxxxxxx"; 6 my $password="XXXXXXXXXXXXXX"; 7 my $user="XXXXX"; 8 9 my $ssh= Net::SSH::Expect->new( host => $host, 10 password=> $password, 11 user => $user, 12 raw_pty =>1); 13 $ssh->login(); 14 15 my $who = $ssh->exec("who"); 16 print ($who); 17 18 $ssh->close();
pp2@nereida:~/src/testing$ netsshexpect.pl casiano pts/0 2008-04-08 16:40 (nereida) casiano pts/1 2008-04-08 15:31 (nereida) casiano pts/2 2008-04-08 17:52 (nereida) casiano pts/3 2008-04-08 17:55 (nereida)