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

后端 未结 8 2183
日久生厌
日久生厌 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.

提交回复
热议问题