Skip to Content
Exploring Expect
book

Exploring Expect

by Don Libes
December 1994
Intermediate to advanced
606 pages
16h 7m
English
O'Reilly Media, Inc.
Content preview from Exploring Expect

Exercises

  1. It takes a long time for GNUS, the Emacs news reader, to start. Rather than watching the window out of the corner of your eye, write a script that starts an iconic window running GNUS. When it is ready to use, get the user’s attention in some way such as by playing a sound or deiconifying the window.

  2. On page 192, I described why it is a good idea to embed the sending of the first AT command to a modem inside a loop. Write the code for this.

  3. The getpass script on page 194 uses the regular expression “(.*)\n” to wait for a password from the user. What might happen if the computer is really bogged down and the user enters several lines in advance? Think of at least two reasons why users will not do this. Modify the script anyway to avoid the problem.

  4. The newgrp command has some peculiar characteristics. For instance, newgrp behaves differently when run from a terminal. And some shells (e.g., /bin/sh) recognize it and run it in such a way that the newgrp removes any traces of the original shell process. Write an Expect script to fix this behavior.

  5. Use the -nocase flag from Chapter 6 (p. 137) to make the script on page 196 a little less vulgar.

  6. Using grep, search through all the source code on your system. Find programs that directly talk to /dev/tty. Justify each program’s use of /dev/tty.

  7. After accidentally falling asleep and rolling your head on the keyboard, you need to delete the files "a sd^F”, "-“, and "-r *“. How would you do this using exec? How would you do this using a ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

AI Agents in Action

AI Agents in Action

Micheal Lanham
Learning Go

Learning Go

Jon Bodner

Publisher Resources

ISBN: 9781565920903Supplemental ContentErrata Page