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

后端 未结 8 2176
日久生厌
日久生厌 2021-02-01 14:08

The use of echo-e \"\\ 029\" does not work either. But if use strg + alt gr + ] directly in a terminal session -> it works.

相关标签:
8条回答
  • 2021-02-01 14:51

    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.
    0 讨论(0)
  • 2021-02-01 14:52

    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)

    0 讨论(0)
  • 2021-02-01 14:56

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

    Then,
    > quit

    0 讨论(0)
  • 2021-02-01 15:01

    To Close Session Use below command

    1. Ctrl + ]
    2. telnet> quit

    it works perfect in REHL and CentOS.

    0 讨论(0)
  • 2021-02-01 15:03

    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 + ç
    
    0 讨论(0)
  • 2021-02-01 15:07

    On Linux it's actually:

    CTRL + ] then ENTER

    Finally type in the quit command.

    ^]
    
    telnet> quit
    Connection closed.
    [fred@localhost ~]$
    
    0 讨论(0)
提交回复
热议问题