Skip to main content
U.S. flag

An official website of the United States government

Official websites use .gov
A .gov website belongs to an official government organization in the United States.

Secure .gov websites use HTTPS
A lock ( ) or https:// means you’ve safely connected to the .gov website. Share sensitive information only on official, secure websites.

expect; Scripts for Controlling Interactive Processes



Don E. Libes


Contemporary shells provide only minimal control (starting, stopping, etc.) over programs, leaving interaction up to users. This means that you cannot run some program non- interactively, such as passwd. Some programs can be run non-interactively, but only with a loss of flexibility, such as fsck. This is where the tool-building philosophy of UNIX begins to break down. expect crosses this line, solving a number of long-standing problems in the UNIX environment.

expect uses Tcl as a language core. In addition, expect can use any UNIX program, whether or not it is interactive. The result is a classic example of a little language synergistically generating large power when combined with the rest of the UNIX workbench.

Previous papers have described the implementation of expect and compared it to other tools. This paper concentrates on the language, primarily by presenting a variety of scripts. Several scripts demonstrate brand-new features of expect.

Computing Systems, University of California Press, Berkeley, CA


expect, interaction, POSIX, programmed dialogue, shell, Tcl, UNIX


Libes, D. (1991), expect; Scripts for Controlling Interactive Processes, Computing Systems, University of California Press, Berkeley, CA, [online], (Accessed April 19, 2024)
Created November 1, 1991, Updated February 17, 2017