Linux Telnet vt100返回键发送^ M [英] Linux Telnet vt100 Return key sends ^M

查看:146
本文介绍了Linux Telnet vt100返回键发送^ M的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用Linux Debian中的TCL和Expect编写Telnet自动化脚本. 在Telnet会话中或在* .tcl脚本中(send "command\r")甚至在send "command\n"中按Return键,将导致该行以 ^ M (Ctrl + M)结尾发送.当然,远程主机将这些命令视为非法.在打开连接之前尝试telnet set crlf,并在连接时尝试mode line,但这无效. 使用Puttys GUI,我启用了选项通过按Return键而不是 ^ M 发送新行.工作正常.如何为telnet配置此选项?

I'm writing Telnet automation scripts with TCL and Expect in Linux Debian. Pressing Return in a Telnet session or within a *.tcl script (send "command\r") and even send "command\n" causes the line being send with ^M (Ctrl+M) at the end. Off course, the remote host treats those commands as illegal. Tried to telnet set crlf prior to the opening of the connection and mode line while connected, but this has no effect. Using Puttys GUI, I've enabled this option to send a new line by pressing Return instead of ^M. Works fine. How do I configure this option for telnet ?

我们将不胜感激!

stty -a

speed 38400 baud; rows 24; columns 80; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;
eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z;      rprnt = ^R;
werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd cs8 -hupcl -cstopb cread -clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon     -ixoff
-iuclc -ixany -imaxbel -iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt
echoctl echoke

stty(启用了stty icrnl)

speed 38400 baud; line = 0;
-brkint -imaxbel

推荐答案

命令"stty"也许可以更改行尾设置.

The command "stty" might be able to change your end-of-line settings.

首先,查看您当前设置的内容:

First, see what you have currently set:

stty -a

然后尝试可用的选项之一.

Then try one of the options available.

stty ocrnl

这应该将回车换成新行.

This should translate a carriage return to a new-line.

您可以使用减号撤消此设置:

You can undo this setting with a minus sign:

stty -ocrnl

如果这样不起作用,请查看onlret或onlcr.

If that doesn't work take a look at onlret or maybe onlcr.

如果没有确切的环境,很难进行测试.

It's difficult to test this without having your exact environment.

这篇关于Linux Telnet vt100返回键发送^ M的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆