Exercises

  1. Modify the timed-read script on page 112 so that it can take an optional default answer which will be returned if the timeout is exceeded.

  2. Modify the rsh script on page 118 so that it returns the remote status of programs no matter how much output they produce.

  3. Modify the rlogin script on page 120 so that it copies the X authority file. Modify the script so that it also supports telnet.

  4. The dump program starts by printing an estimate such as:DUMP: estimated 1026958 blocks (501.44MB) on 0.28 tape(s).Write a script to print out how many tapes the next backup will take.

  5. dump’s knowledge of backup peripherals is often out of date. Assuming you are using a device much bigger than dump realizes, write a script so that dump never stops and asks for a new tape.

  6. Enhance the script you wrote for the previous question so that it does a better job of asking for tapes. For example, if your tapes are ten times as big as dump thinks, then the script should ask only once for every ten times that dump asks.

Get Exploring Expect 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.