Name

interact

interact [[options] string1 body1] ... [[options] stringn [bodyn] ]

Pass control of a spawned process to the user. Checks user input against zero or more strings. If a match occurs, the corresponding body is executed.

Patterns

The pattern can be a string. By default, exact string matching is used but 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.

null

Matches a single ASCII NUL (0) character.

timeout seconds

Matches when timeout occurs since the last pattern was matched.

Options

-re

Use regular expression pattern matching.

-ex

Use exact string pattern matching (default).

-indices

Used in conjunction with -re to store indices of matching patterns in the interact_out array.

-output spawn_id_list

Specify a list of spawn IDs to be used for output.

-input spawn_id_list

Specify a list of spawn IDs to be used for input.

-iwrite

Cause all matches to set the variable interact_out (spawn_id) before per forming their associated action.

-reset

Reset the terminal mode to the settings it had before interact was executed.

-echo

Send the characters that match the following pattern back to the process that generated them.

-nobuffer

Send characters that match the pattern to the output process immediately as they are read.

-o

Apply any following pattern body pairs against the output of the current process.

-i

Introduce a replacement for the current spawn ID when no other -input or -output flags are used.

-u spawn_id

Cause the ...

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.