Special Variables
The following variables have special meaning to the Expect program.
spawn_idSpawn descriptor for the current spawned process (can be set).
user_spawn_idSpawn descriptor for user input.
tty_spawn_idSpawn descriptor for /dev/tty.
any_spawn_idUsed in expect command to match input on any active spawn descriptor.
error_spawn_idSpawn descriptor for standard error output.
argvList containing the command-line arguments.
argcThe number of elements in argv.
argv0The name of the script or program being run.
exp_exec_libraryDirectory containing architecture-dependent library files.
exp_libraryDirectory containing architecture-independent library files.
expect_outArray 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, wherenis 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_outArray containing output strings collected by interact command, in the same format as
expect_out.send_humanControls behavior of send with the -h option. A list of five numeric elements: (1) interarrival time of characters, (2) interarrival time of word endings, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access