How to make expect command in expect program script to wait for exact string matching How to make expect command in expect program script to wait for exact string matching unix unix

How to make expect command in expect program script to wait for exact string matching


You're already using it earlier in your script: expect -exact. But long matching strings are pretty much guaranteed to cause problems; you should try to cut it down to the shortest unique match, if necessary breaking it into multiple expect commands.

In this case, just based on what you show, the proper command is probably expect -exact "choice:". But inherently it is not possible to determine this without full details of the possible program outputs.