【发布时间】:2014-05-30 20:19:29
【问题描述】:
我是 perl 的新手。我试图登录到 cisco 路由器来执行一些命令。
我能够使用Net::SSH::Perl 登录并执行几个命令。
但是当我尝试切换到配置模式时,脚本失败了。
br-waas#
br-waas#configure
br-waas(config)#
是否有一个 perl cpan 模块可以做到这一点?
use Net::SSH::Perl;
my $host = "XX.XX.XX.XX";
my $user = "XXXX";
my $password = "XXXX";
my $ssh = Net::SSH::Perl->new($host);
$ssh->login($user, $password);
print "check the version of the build \n";
my ($stdout) = $ssh->cmd("show statistics accelerator http object-cache");
print $stdout;
sleep(3);
print "enter the config mode \n";
my($stdout1) = $ssh->cmd("config");
print "$stdout1 \n";
当执行配置命令时,脚本失败并出现以下错误。 % Invalid input detected at '^' marker.
【问题讨论】:
-
脚本如何失败?你具体观察到什么?到目前为止,您使用的代码在哪里?
-
@Miller 我已经添加了上面的代码。当配置命令执行时,脚本失败并出现以下错误。 % 在“^”标记处检测到无效输入。
标签: perl perl-module