expect

expect [ -dDinN ] [ -c cmds ] [ [ -[f|b] ] cmdfile ] [ args ]

INTRODUCTION
Expect is a program that “talks” to other interactive programs accord‐
ing to a script. Following the script, Expect knows what can be
expected from a program and what the correct response should be. An
interpreted language provides branching and high-level control struc‐
tures to direct the dialogue. In addition, the user can take control
and interact directly when desired, afterward returning control to the
script.

Expectk is a mixture of Expect and Tk. It behaves just like Expect and
Tk’s wish. Expect can also be used directly in C or C++ (that is,
without Tcl). See libexpect(3).

The name “Expect” comes from the idea of send/expect sequences popular‐
ized by uucp, kermit and other modem control programs. However unlike
uucp, Expect is generalized so that it can be run as a user-level com‐
mand with any program and task in mind. Expect can actually talk to
several programs at the same time.

For example, here are some things Expect can do:

· Cause your computer to dial you back, so that you can login
without paying for the call.

· Start a game (e.g., rogue) and if the optimal configuration
doesn’t appear, restart it (again and again) until it does,
then hand over control to you.

· Run fsck, and in response to its questions, answer “yes”,
“no” or give control back to you, based on predetermined
criteria.

· Connect to another network or BBS (e.g., MCI Mail, Com‐
puServe) and automatically retrieve your mail so that it
appears as if it was originally sent to your local system.

· Carry environment variables, current directory, or any kind
of information across rlogin, telnet, tip, su, chgrp, etc.

There are a variety of reasons why the shell cannot perform these
tasks. (Try, you’ll see.) All are possible with Expect.