Chapter 22
Home Up Errata / Updates Why Shell? Using Telnet Telnet Logging Chapters 1&2 Chapters 3&7&13 Chapters 4&5 Chapters 6&8 Chapter 22 Chapter 23 Chapters 10&12 Chapter 14 Chapter 15
Updated:
2000-12-02 15:27

Chapter 22 Exercises

Read Chapter 22 of the Unix text and work on the Unix system. Make sure you can answer the following questions:

Chapter 22     Shell Script Programming

 (Pages 912-955 only)

22.1     After you completed checkuser on page 921, explain the execution result if you were to change the last line of checkuser to read:    who | grep name | wc -l

22.2     Give the special line used to start a shell script that requests that the Korn shell interpret the lines in a script file.  What line would you use if you wanted the Bourne shell to interpret the script?

Note: When you reach page 923 to create a script called menu, make sure the name menu isn't already in use as an existing command or alias.  If it is, choose another name for your script.

22.3   What is a here document?  Give an example of how to use one.

22.4     Explain how to tell a shell to run a script in debug mode, so that you can see each command as it executes.

22.5     Remove the closing ++ tag in menu1 as suggested on page 926. Run the script in debug mode. Explain what happens.

22.6     If you change both the uses of the ++ tag to the string %% in menu1, will the program menu1 still work? Test it.

22.7     After the case structure has been put into the menu1 script as specified by page 929 and is working correctly, make a copy of the working script and remove from the copy the double semicolon (";;") after pwd.  Execute the edited copy of the script.. Explain what happens if you select option 1.  Delete the copy when you are done.

22.8     Two types of loop are introduced in section 22.7. State their syntax formats (how are the loops constructed) and give an actual working example of each type of loop.

22.9 A-H     Do the 8 questions of Review 2 on pages 943-4.

22-10     How do you stop the cursor from advancing to a new line when you issue an echo command?

These exercises created originally by Maitang Mark

Web Author: Ian! D. Allen idallen@ncf.ca
Updated: 2000-12-02 15:27