The continue And break Actions
Like the expect
command, it is possible to have the interact
command cause its caller to break
or continue
. Each of these can be used as an action. For example, in the following loop, if a user presses "+
“, interact
returns and the while
loop breaks.
while {1} { interact "+" break }
The continue
command works similarly. In the following loop, if a user presses "+
“, the interact
returns and the loop breaks. If the "-
" is pressed, the interact
returns, and the while
loop continues.
while {1} { interact "+" break "-" continue }
Get Exploring Expect now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.