I need an expect
script to wait for an issued command to finish, and then log out from telnet
. Here is the script:
spawn telnet host
send "username\r"
send "password\r"
sleep 3
send "custom_command\r"
while {???}
{
sleep 1
}
send "logout\r"
expect eof
The part that I don't know how to phrase is ???
. I basically just need to wait for the prompt
to show up, and as soon as it shows up, the script should end. I'm guessing it should be something like [gets line != "prompt>" ]
.