while loop in expect script
问题 I'm new to expect scripting, I want to write something like this: set variable; $variable = expect -exact "\/----Enter Password----\\" while { != $variable } { send -- {^[-} } I want to keep sending escape+hyphen character until I expect this prompt: "/----Enter Password----\". I have written the above code but it is not working. How do I do this, kindly help me. 回答1: You can make use of exp_continue to handle this situation. The command exp_continue allows expect itself to continue executing