Special Variables
The following variables have special meaning to the Expect program.
spawn_id
Spawn descriptor for the current spawned process (can be set).
user_spawn_id
Spawn descriptor for user input.
tty_spawn_id
Spawn descriptor for /dev/tty.
any_spawn_id
Used in expect command to match input on any active spawn descriptor.
error_spawn_id
Spawn descriptor for standard error output.
argv
List containing the command-line arguments.
argc
The number of elements in argv.
argv0
The name of the script or program being run.
exp_exec_library
Directory containing architecture-dependent library files.
exp_library
Directory containing architecture-independent library files.
expect_out
Array containing output strings collected by the expect command (see the description of expect, later in this chapter).
expect_out(buffer)
Matching any previously unmatched output.
expect_out(
n
, string)
Substring that matched regular expression
n
, wheren
is 1 through 9.expect_out(0
,string)
String that matched entire pattern.
expect_out(
n
, start)
Starting index in buffer of regular expression
n
.expect_out(
n
, end)
Ending index in buffer of regular expression
n
.expect_out(spawn_id)
Spawn ID associated with matching output.
spawn_out(slave
,name)
Name of the pty slave device.
interact_out
Array containing output strings collected by interact command, in the same format as
expect_out
.send_human
Controls behavior of send with the -h option. A list of five numeric elements: (1) interarrival time of characters, (2) interarrival time of word endings, ...
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.