ActiveState Community

Tcl Expect

Posted by dave_mairs on 2008-02-27 07:29

I'm confused with the following syntax, I believe it should
stay in the loop expecting "anyway" and "first" not in any paticular
order and not breking out until it finds "$prompt". It is acting like
3 individual expect commands in the cronological order that there listed in.
Can somebody HELP??? I need this fixed soon:

for {} 1 {} {
expect -i $id timeout {FAIL} *anyway*
send "yes\r\n"
send_user "\n$expect_out(buffer),$expect_out(1,string)\n"
sleep 1
expect -i $id timeout {FAIL} *first*
send "yes\r\n"
send_user "\n$expect_out(buffer),$expect_out(1,string)\n"
sleep 1
expect -i $id timeout {FAIL} -re $prompt
{break}
send_user "\n$expect_out(buffer),$expect_out(1,string)\n"
}