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
You send the ESC control sequence. Try send "\x1b\r"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With