Search code examples
tcltelnet

how do I sent escape character ^] through a spawned telnet session?


I am able to open a spawned telnet session in a shell script to run some commands. Afterwards, I am trying to send the escape character using send (see syntax below) but it never gets to the part where I am able to close the session. Can someone point me in the right direction? Due to this issue, I am opening up multiple telnet sessions this way, which I do not want to do.

send "^]\r"
expect "telnet>"
send "close\r"
close $spawn_id 

Solution

  • You send the ESC control sequence. Try send "\x1b\r"