Exercises

  1. Experiment with telnet by writing a script to try all of the different port numbers. Record what comes back.

  2. In the aftp script on page 141, I hardcoded my own name and address. Modify the script so that it uses the name and address of whomever runs it.

  3. Write the putfile and putdirectory procedures that are used by the excerpt from rftp on page 131.

  4. Write a procedure to count the number of lines in a string. Do it without looping. Modify the procedure so that it counts the number of digits in a string. Where might this be useful?

  5. Enhance the maxtime script from Chapter 4 (p. 98) so that it can exit after there is no output for the given amount of time. Provide a command-line option to select this behavior.

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.