Can't close a scpi(telnet) session with echo “^]” when I use it in a script

谁都会走 提交于 2019-12-02 18:49:57
Kajackdfw

On Linux it's actually:

CTRL + ] then ENTER

Finally type in the quit command.

^]

telnet> quit
Connection closed.
[fred@localhost ~]$
Kindi BALDE

To quit telnet on redhat:
type "CTRL+5" and then type "quit"

To Close Session Use below command

  1. Ctrl + ]
  2. telnet> quit

it works perfect in REHL and CentOS.

The ^] means ctrl + right bracket. As strange as that is, it works. You'll be taken to the telnet prompt, where you can type quit.

On international keyboards the ] character is often not a single key, and needs to be replaced with some other key. The correct key is typically the key to the right of P or the next key after that.

Here's a list based on comments below:

Finnish, Swedish, Norwegian, Danish: ctrl + å
French: ctrl + 6
German: ctrl + ü
Swiss: ctrl + ¨
Hungarian: ctrl + 5
Portuguese: ctrl + ´
Dutch, Belgian: ctrl + $
Canadian French: ctrl + ç
Kristian

On my danish keyboard it was not Ctrl + å - but instead the key to the right side of å (which has a hat, a tilde and a umlaut)

It must be so. Because ^] printed in the terminal on the server means for the client side nothing. The client must catch this symbol before it will be transmitted to server and of course you can't just write it to terminal in te program running on the server.

So you need to interrupt session in other way. There are many methods.

  1. If you are inside the running program, you can simple terminate it (exit in shell or sys.exit() in python or exit() in many other languages).
  2. If you can't control program flow you can close terminal by killing the process that is owner of the terminal. You need to find the process and then use kill ... (PID of the process instead of ...).
  3. If you want to close the client from client side, you need to do the same (kill ...) but on the client side.

Ctrl + ] This will show as ^] and then

telnet> q q is for quit

On MacOS with Turkish keyboard try:
Ctrl + Option + ü

Then,
> quit

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