Errata for UNIX Shell Programmer’s Interactive Workbook

Christopher Vickery
Prentice Hall PTR, 1999
ISBN 0-13-020064-6

Page xvii. Change "baggage" to "babbage" on the last line so that the URL for my home page becomes

Page 3, Line 12. Add the following sentence after " Escape key before Control-V to see the version message."

If that doesn't work, enter the command, VISUAL=emacs before typing Control-V.
Page 5, Line 4. Change the url that begins "http://research … " to

Page 7, Line 2. Change the url that begins "http://research … " to

Page 23, line 8. Change .ksrhc to .kshrc.

Page 31, line 8. Change f113 to f133. Page 37, line 9 from the bottom. You should have seen "This is /bin/ksh" rather than "This is s131". Your output would vary, depending on the actual path to ksh on your system. Under UWIN, it might show up as "-ksh" indicating that it is your login shell. The output shown was taken from interactions I had with ksh under UWIN at the time the book was written and does not reflect the correct behavior of ksh, as seen on current systems.

Page 38, lines 17 and 25. Same error as Page 37, line -9.

Page 41, lines -3 and -10. Same error as Page 37, line -9.

Page 42, line 13. Same error as Page 37, line -9.

Page 49, line 9. Change "-l" to "-lF" near the end of the line.

Page 56, five lines from the bottom. Change "... argument for -1.14 ..." to "... argument for -o, and -1.14 ...".

Page 99, line 4. Change "out <" to "< out".

Page 104, Line 5. Change ">/" to ">|".

Page 106, Answer f. "It means that both stdout and stderr are redirected ..."

Page 114, Question 2. Should end with "question 1" instead of "questions 1.".

Page 114, Question 3. The last symbol should be >| instead of >1.

Pages 119 to 121, Tasks lettered "a)" through "e)" should be lettered "d)" through "h)".

Page 153, line 15. The M in MONDAY should be boldface.

Page 159, Question 1d. Put quotes around

"function overwrite {"
and around
"overwrite() {."

Page 184 After the Tip. Insert the heading, "4.2.2 Answers."

Page 200, seven lines from the bottom. The shaded box that says "4.3.4 Answers" should be a section heading that says "Lab 4.3 Answers".

Page 213, third line from the bottom of the page. Change "name" to "named" at the end of the line.

Page 218, line 8. Change "Run a         command ..." to "Run a print command ..."

Page 243, line 6. The line, "getopts ab: optletter," must be repeated a second time for the error message to occur.

Pages 256 through 321 (All of Chapter 6). The running head should be "Advanced Variable Usage" rather than "ADVANCED VARIABLE USAGE."

Page 267, middle of the page. Change "y = x/2 = y * 4" to "y = x/2, z = y * 4"

Page 267, last line. Change "... inside a script ..." to "... inside a dotted script ...".

Page 268, Line 2. Change "inside a script ..." to "inside a dotted script (or inside a function) ...".

Page 337, 9 lines from the bottom of the page. The first line of the script should not have an "a" after the pound sign. It should look like this:

 # s712 -- Print a message if option a is set. 
Page 342, second line. Insert a backslash ( \ ) between "$1" and "is", and move "is" to the beginning of the next line.

Page 364, between the first and second lines. Add: "If the function does not execute a return statement, the exit code is that of the last command executed within the function.".

Page 370, lines 5-9 should look like this:

      #  The variables a_opt, b_opt, and c_opt will be
      #  either empty strings or the string "on",
      #  depending on the command line, when this
      #  function terminates.
Page 383. In both functions, insert a line of code that says "shift" between the lines that begin with "do" and "done".

Page 407, 6th line from the top. Put a backslash ( \ ) after the word "Unrecognized."

Page 429, line 5. Change "With the same file in your ... " to "With the same files in your ..."

Page 432, line 2, change ((i=1; i<6; i++)) to ((i=1; i<=6 i++)).

Page 432, line 3. Add a colon after "digit" so the line looks like this:

      print [[:alpha:][:digit:]]
Page 442, after line 2. Add the following answers for questions d) and e) of Exercise 10.1.2:
d) What is the difference between the outputs of the first two commands?
The first command prints all one-character file names (1, 2, 3, 4, 5, 6, a, b,c, d, and e), whereas the second one prints all filenames that end with a character (i.e., all of them).
e) What is the difference between the outputs of the second two commands?
The second two print the same thing (the names of all the files), for similar reasons. The second prints all filenames that end with a character, whereas the third prints all filenames that start with a character.
Page 443, line 15, change ((i=1; i<6; i++)) to ((i=1; i<=6 i++)).

Page 444, bottom of the page. Add the following paragraph:

The command on line 1022 prints all file names that start with any character that is not (the first exclamation mark indicates negation) an exclamation mark (the second exclamation mark is escaped, so it is a literal part of the pattern). In this case, there are no file names that start with an exclamation mark, so all file names are printed.
Page 459, line 19. Insert the following answer, and change the letters of answers e) and f) to f) and g) respectively.
e) Why are there quotes around the command substitution of the vi command?
Answer: If the name of the file to be edited has a space in it, the quotes insure that the vi command will receive the proper name of a single file to edit.
Page 470, 7th line from the bottom. Change "shortest right pattern" to "longest right pattern" for the %% operator.

Page 482, line 2. Change the open parentheses to an open brace so the line looks like the following:

Page 487, 7th line from the bottom. Change "[-U [n] ]" to "[-u fd]".

Page 507, 5th line from the bottom. Change "(/t)" to "(\t)".

Page 552, last line. Change F to B.

Page 561, first line. Change "-et" to "-ef".

Page 565, line 10. Change "exec [n]< writefile" to "exec [n]> writefile".

Page 568, Lab 3.2, Question 4. Add this after the explanation: "If a command does not consume all of stdin, the remaining input will be passed to the next command(s) in the group until either all the input has been consumed or all the commands have completed execution.".

Page 572, third line from bottom of page. Make "done" boldface.

Page 580, third item. Delete the space between the ":" and the "=" so it looks like, "${parameter:=word}".

Page 581. Change "${parameter#word}" to "${parameter#pattern} in line 1 of the first column. Similarly for lines 2-4 of the first column.

Page 601 (not a numbered page). Change 496 to 596 as the number of pages in this book.

Page 606 (not a numbered page). Replace this page with one that describes the correct CD-ROM.