Using Expect to Automate System Administration Tasks

Don Libes · 1990

UNIX system 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, one can run interactive programs non-interactively. Shell scripts are incapable of managing these system 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 system administrator who can program in the shell alr...

Read the paper · More papers on PaperTik