Auto exit Telnet command back to prompt without human intervention ^] quit close exit code 1

前端 未结 5 901
灰色年华
灰色年华 2020-12-31 20:12

I\'m running telnet command on a host for a given port (which is open), it returns 0 (success).

For trying telnet manually, I type the following comman

5条回答
  •  再見小時候
    2020-12-31 20:42

    A slight improvement to the answer provided by Matthew above which allows you to use it inside shell scripts:

    $ echo -e '\x1dclose\x0d' | telnet google.com 80
    Connected to google.com.
    Escape character is '^]'.
    
    telnet> close
    Connection closed.
    $ echo $?
    0
    

提交回复
热议问题