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.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Learning Go

Learning Go

Jon Bodner
Command-Line Rust

Command-Line Rust

Ken Youens-Clark
Hands-on Ansible

Hands-on Ansible

Sander van Vugt

Publisher Resources

ISBN: 9781565920903Errata Page