方法一:
$chan2 = $ssh2->channel();
$chan2->blocking(0);
print $chan2 "tail -5 /var/log/authlog\n";
print "**$_" while <$chan2>;
方法二:
#shell use
my $chan2 = $ssh2->channel();
$chan2->shell();
print $chan2 "uname -a\n";
print "LINE : $_" while <$chan2>;
print $chan2 "who\n";
print "LINE : $_" while <$chan2>;
$chan2->close;