Name
expect
- expect
[[
options
]pat1 body1
] ... [options
]patn
[bodyn
] Compare output from one or more spawned processes against patterns. If a match is found, execute the associated code body and return.
The exp_continue command inside a body causes the expect statement to continue execution rather than returning.
Patterns
The pattern can be a string. By default, shell globbing is used, but this can be changed using options listed in the next section. A pattern can also be one of the following special names:
eof
Matches end of file.
full_buffer
Matches when maximum number of bytes has been received with no pattern match.
null
Matches a single ASCII NUL (0) character.
timeout
Matches when timeout occurs with no pattern matched.
default
Matches if timeout or
eof
occur.
Options
- -timeout
seconds
Specify amount to wait before timing out.
- -i
spawn_id_list
Match against the listed spawn IDs; either a literal list or a global variable name containing the list.
- -gl
Use glob-style pattern matching (default).
- -re
Use regular expression pattern matching.
- -ex
Use exact string pattern matching.
- -nocase
Make matching case-insensitive.
Get Tcl/Tk in a Nutshell 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.