Using Expect to Automate System Administration Tasks

Published: January 01, 1990


Don E. Libes


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)
Pub Type: Conferences

Download Paper


Expect, interactive programs, programming, scripts, UNIX
Created January 01, 1990, Updated February 17, 2017