【发布时间】:2019-12-24 19:36:40
【问题描述】:
使用 Net::SSH::Expect Perl 模块我想连接到服务器。
下面是我的代码
#!/usr/bin/perl
use Net::SSH::Expect;
my $ssh = Net::SSH::Expect->new (
host => 'hostip', #deb-2-scripting ip
user => 'user',
password => 'password',
raw_pty => 1
);
..
..
..
$ssh->close();
创建 $ssh 对象后,我想检查与 SSH 的连接是否成功。
如何做到这一点? Net::SSH::Expect 中是否有任何方法可以在连接成功或失败时返回布尔值。
【问题讨论】: