Linux Telnet vt100 Return key sends ^M

久未见 提交于 2019-12-06 09:12:23

问题


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 ?

Help would be much appreciated!

Edit:

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 (with stty icrnl enabled)

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

回答1:


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

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

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



来源:https://stackoverflow.com/questions/30405054/linux-telnet-vt100-return-key-sends-m

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!