bash Cookbook by Carl Albing, JP Vossen, Cameron Newham This errata page lists errors outstanding in the most recent printing. If you have technical questions or error reports, you can send them to booktech@oreilly.com. Please specify the printing date of your copy. This page was updated February 19, 2008. Here's a key to the markup: [page-number]: serious technical mistake {page-number}: minor technical mistake : important language/formatting problem (page-number): language change or minor formatting problem ?page-number?: reader question or request for clarification Confirmed errors: (5) Second sentence in Discussion paragraph; The second sentence reads "-L displays your logical path and is the default.s displays your physical location, ..." Probably should read "-L displays your logical path and is the default. -P displays your physical location, ..." (7) Middle of the page; The sentence "For much more on the find command, ..." is a bit disconcerting because nothing at all has been said about the find command (61) func_choose Add a trailing \n in the example near the middle of the page: # 'printf "%b" "See you later Professor Falkin.\n"' >&2 Replace "exec" with "eval" in 2 lines at the bottom of the page: [yY1] ) eval "$choice_yes" [nN0] ) eval "$choice_no" {pg62} func_choice.2 "until [ "$CHOICE" = "y" ]; do" If CHOICE is already set, it won't prompt. You may want to unset the var. Add "CHOICE=''" # cookbook filename: func_choice.2 CHOICE='' until [ "$CHOICE" = "y" ]; do (62) func_choice.2 "$THISPACKAGEwith" There should be a space. Add a space in "$THISPACKAGE with": elif [ "$CHOICE" != "y" ]; then printf "%b" "Overriding $THISPACKAGE with ${CHOICE}\n" THISPACKAGE=$CHOICE (62) func_choice.1 "$ Returns: global variable CHOICE" $ should be #. "# Returns: global variable CHOICE" (63) func_choice.3 _printf "%b" "You chose: $CHOICE"_ _printf "%b" "You do not have a favorite color."_ Need "\n". Add "\n", should look look like: printf "%b" "You chose: $CHOICE\n" printf "%b" "You do not have a favorite color.\n" {64} select_dir Replace: directorylist="Finished $(ls /)" with directorylist="Finished $(for i in /*;do [ -d "$i" ] && echo $i; done)" {74 and 75} the code fragment: if (( $? )); then rm * ; fi Should be: if (( $? == 0 )); then rm * ; fi or: if (( ! $? )); then rm * ; fi <228-229> 11.9 Using date and cron to Run a Script on the Nth Day Add Warning: Vixie Cron interprets an unescaped % as a newline, so the % in '+%a' must be escaped like '+\%a' if using Vixie Cron (e.g. most/all Linux). Add note: If cron seems like it's not working, try restarting your MTA (e.g. sendmail). Some versions of cron on some systems (e.g. Vixie Cron on Red Hat) are tied into the sendmail process. See https://bugzilla.redhat.com/show_bug.cgi?id=247228. (256) parseViaFunc Was: CRDATE=$6 CRTIME=$7 FILE=$8 } Add "CRDAY=$7" and increment other positional variables: CRDATE=$6 CRDAY=$7 <<< Added CRTIME=$8 FILE=$9 } (421) archive_meta-data Remove unbalanced '\)' in last line of solution code. was: -printf '%m\t%u\t%g\t%s\t%t\t%p\n' \) >> archive_file should be: -printf '%m\t%u\t%g\t%s\t%t\t%p\n' >> archive_file (507) line 14; The line beginning ">> file" should begin "n>> file". From the author: What I am trying to show in the examples is expansion of revision meta-data (keywords), so the first instance is literal: # $Id$ while the second instance is support to be expanded, e.g.: # $Id: hello,v 1.4 2006/07/21 08:57:53 jp Exp $ Something happened to my $Id$ lines. Between the Aardvark issues and my other revision control stuff, it probably just got nuked by a revision control system itself. But they are broken. Here is what they should be, but the chapter is otherwise OK. It is supposed to show the addition of they keyword $Id$, then last in the example the expansion of that keyword. The example examples got nuked. App D pages: (540) "Create a new project and import it" /tmp$ mkdir 0700 scripts missing '-m', should be: /tmp$ mkdir -m 0700 scripts (543) example at bottom, 3 issues [1]. /home/jp/scripts$ cat hello #!/bin/sh $Id$ missing '#' should be: # $Id$ Trivial (missing '*'): /home/jp/scripts$ cvs ci -m'Added ID keyword' hello /home/jp/scripts$ cvs ci -m'* Added ID keyword' hello /home/jp/scripts$ cat hello #!/bin/sh # $Id$ should be: # $Id: hello,v 1.4 2006/07/21 08:57:53 jp Exp $ (544) above "See Also" /home/jp/scripts$ cat hello #!/bin/sh # $Id$ should be: # $Id: hello,v 1.4 2006/07/21 08:57:53 jp Exp $ (540 and 546) end of 1st sent. add for clarity: This example is not suitable for enterprise or multiuser access (see the "More Resources" section in the Preface [for clarity add: "of this appendix"). This is in 2 places and is more broken than I thought. The references are in the "See Also" parts of section, as I originally noted. I'm not sure where the "More Resources" or Preface stuff came from, but they are wrong. (545) /home/jp/bin$ cat hello #!/bin/sh # $Id$ should be [1]: # $Id: hello,v 1.4 2006/07/21 09:18:09 jp Exp $ {546} end of 1st sent. add for clarity: This example is not suitable for enterprise or multiuser access (see the "More Resources" section in the Preface [for clarity add: "of this appendix"). (549) 4 issues in the example in the middle of the page Cosmetic: /home/jp/scripts$ vi hello /home/jp/scripts$ cat hello should have "/trunk" /home/jp/scripts/trunk$ vi hello /home/jp/scripts/trunk$ cat hello Trivial (missing '*'): /home/jp/scripts/trunk$ svn ci -m'Added ID keyword' hello /home/jp/scripts/trunk$ svn ci -m'* Added ID keyword' hello (Note, first instance of "# $Id$" is correct as-is.) /home/jp/scripts/trunk$ cat hello #!/bin/sh # $Id$ should be [1]: # $Id: hello 5 2006-07-21 09:09:34Z jp $ (550) /home/jp/scripts/trunk$ cat hello #!/bin/sh # $Id$ should be [1]: # $Id: hello 5 2006-07-21 09:09:34Z jp $ (554) just above "Compare the current revision to r1.2" (Note, first instance of "# $Id$" is correct as-is.) /home/jp/bin$ cat hello #!/bin/sh # $Id$ should be [1]: # $Id: hello,v 1.4 2006/07/21 09:18:09 jp Exp $ 580, 3rd line up from bottom, 581, 3rd line up from see also # $Id: hello,v 1.4 2006/07/21 08:57:53 jp Exp $ 586, 17th line up from bottom, more or less 587, 3rd line up from see also # $Id: hello 5 2006-07-21 09:09:34Z jp $ 591, 22nd or so line up from bottom 592, 2nd line from top # $Id: hello,v 1.4 2006/07/21 09:18:09 jp Exp $ 594, 3rd line of 2nd para in Document Comparison, remove "in Chapter 12" for consistency with the rest of the xrefs in the book.