Exercises
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.
On page 192, I described why it is a good idea to embed the sending of the first
ATcommand to a modem inside a loop. Write the code for this.The
getpassscript 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.The
newgrpcommand has some peculiar characteristics. For instance,newgrpbehaves differently when run from a terminal. And some shells (e.g.,/bin/sh) recognize it and run it in such a way that thenewgrpremoves any traces of the original shell process. Write an Expect script to fix this behavior.Use the
-nocaseflag from Chapter 6 (p. 137) to make the script on page 196 a little less vulgar.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.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 usingexec? How would you do this using a ...