Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

telnet

tcl

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 
like image 733
user2840240 Avatar asked Oct 16 '13 18:10

user2840240


1 Answers

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

like image 61
glenn jackman Avatar answered Sep 21 '22 21:09

glenn jackman