I was wondering if anyone with some expect scripting experiencing can shed some light on the following issue. I have wrote an expect script that logs onto a router and drops you into enable mode. That script works perfectly fine, but I have ran into an unforeseen issue. Apparently our network has 2 passwords that are currently in use among all the routers and there is no way of knowing which routers use what passwords other than trying them. So basically what happens is that the following expect statement works fine if it hits a router with the password coded into the script. But what I am trying to do is that if the first password fails and does not generate a ">" prompt as the script expects and instead generates another " "Password:" prompt I want it to try the second password. This is what I have so far, it does not integrate a check in case the first password fails, Im at a loss of how to implement it:

"Password:" {
exp_send "somepass\r"
expect ">"
exp_send "enable\r"
expect "Password:"
exp_send "somepass\r"
expect "#"
interact + return
}