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.

Using Expect to Automate System Administration Tasks

Published

Author(s)

Don E. Libes

Abstract

UNIX systems administration often involves programs designed only for interactive use. Many such programs (passwd, su, etc.) cannot be placed into shell scripts. Some programs (fsck, dump, etc) are not specifically interactive, but have poor support for automated use. Expect is a program which can talk to interactive programs. A script is used to guide the dialogue. Scripts are written in a high-level language and provide flexibility for arbitrarily complex dialogues. By writing an expect script, can run interactive programs non- interactively. Shell script are incapable of managing these systems administration tasks, but expect scripts can control them and many others. Tasks requiring a person dedicated to interactively responding to badly written programs, can be automated. In a large environment, the time and aggravation saved is immense. Expect is similar in style to the shell, and can easily be mastered by any systems administrator who can program in the shell already. This paper presents real examples of using expect to automate system administration tasks such as passwd and fsck. Also discussed are a number of other systems administration tasks that can be automated.
Proceedings Title
Proceedings of the Fourth USENIX Large Installation Systems Administration (LISA)

Keywords

Expect, interactive programs, programming, scripts, UNIX

Citation

Libes, D. (1990), Using Expect to Automate System Administration Tasks, Proceedings of the Fourth USENIX Large Installation Systems Administration (LISA), [online], https://tsapps.nist.gov/publication/get_pdf.cfm?pub_id=821312 (Accessed April 25, 2024)
Created January 1, 1990, Updated February 17, 2017