CHAPTER 17Automating User Input withexpect

The expect utility's name suggests precisely what it does: "expect" some output from an interactive program, and send the program some input in response. expect has much more functionality than I cover in this chapter, but this chapter provides a good example of how it can be used. To find more complete information, you can consult the expect manual page.

You may find that when you try to automate a task, the utilities or tools you are using don't lend themselves well to scripting. In the past, use of the format or fdisk command (along with many others) was difficult to automate. Today we have versions of these utilities, such as sfdisk, that are much easier to use within a script. A more modern use ...

Get Expert Shell Scripting now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.