这个脚本的输出是包装的,这是我不想要的。
use strict;
use Net::Telnet;
system("mode 500,6000");
print "passwd: ";
my $passwd=<>;
chomp($passwd);
my $telnet = Net::Telnet->new(Host=>'linux63.blahblah.edu',Prompt=>'/l+inux63> $/');
$telnet->waitfor('/login/');
$telnet->print("myusername");
$telnet->waitfor('/Password/');
$telnet->print("$passwd\n");
$telnet->waitfor('/linux63/');
my @lines = $telnet->cmd("somecommand");
#etc
$telnet->print("logout\n");此脚本的输出打印为:
This is the output of some command, has more than 80 characters in this line whic
h should not be broken我想像下面这样,有什么帮助吗?
This is the output of some command, has more than 80 characters in this line which should not be broken脚本中使用的以下mode命令没有帮助。
system("mode 500,6000");发布于 2014-12-13 05:42:24
看起来Net::Telnet支持选项协商,而RFC 1073是telnet窗口大小选项的标准。您应该宣传您的宽度,并使用IAC SB NAWS ( WILL NAWS ) ( height ) IAC SE响应对DO NAWS的服务器请求,其中的宽度和高度被编码为16位大端(pack的n模板)。
https://stackoverflow.com/questions/27452428
复制相似问题