Errata

bash Cookbook

Errata for bash Cookbook, Second Edition

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Color key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted By Date submitted Date corrected
Page 53
Toward the bottom

"You can also use the xarg command."

"xarg" should be "xargs"

Note from the Author or Editor:
First, we're really sorry we never got back to this! We try to keep up on errata (we get emails), but somehow a number of them slipped through.

This is verified, and I've just fixed it in the source, thanks for the report!

Andy Lester  Jan 08, 2020 
Page 90
code in solution

The if test is like this
if [ -f "$SCRIPT" -a -x "$SCRIPT" ]
But in the main text we have -f and -x.

Note from the Author or Editor:
First, we're really sorry we never got back to this! We try to keep up on errata (we get emails), but somehow a number of them slipped through.

The code is correct, but I see we failed to clarify that the `-a` is an "and" in the test. I just changed it to `...If it is a file (the ++-f++ test) _and_ (++-a++) has execute permissions ...`, thanks for the report.

Murpholinox Peligro  Mar 10, 2020 
Page 110
last paragraph

Second sentence in the paragraph reads "Left unquoted, $* and $& give you..." but should read "Left unquoted, $* and $@ give you...".

The whole section is about using $@ as opposed to $* . Otherwise, there is no such thing as $& . I was confused by its appearance for about 2 minutes til I searched the book for more instances of the typo and found none, confirming my suspicion that it was in fact just a typo.

Note from the Author or Editor:
Correct, and nice catch, thanks. I've fix that in the Atlas repo.

Grant Gillespie  May 31, 2023 
Page 112
Top of the page

The name of the variable is $# but is shown in the text as ${}. Later, it's either $# or ${#}.

Note from the Author or Editor:
First, we're really sorry we never got back to this! We try to keep up on errata (we get emails), but somehow a number of them slipped through.

This is verified, and it's a known issue we have with how the tool-chain renders Asciidoc. :-( We even have a FIXME in the source about that, but we missed the one you mention. I just changed the sourcea from `++${#}++` to the simpler ++$#++ which as noted works elsewhere. The `++${#}+` version tat works is ` ++${#}++`. (Sigh.)

Thanks for the report!

Andy Lester  Jan 09, 2020 
Page 135
Table 6-1

expected: ' |= Bitwise “or” a|=b a=(a|b)'
printed: ' \ = Bitwise “or” a|=b '

Note from the Author or Editor:
First, we're really sorry we never got back to this! We try to keep up on errata (we get emails), but somehow a number of them slipped through.

This is verified, its a bug in our Asciidoc table code, I just fixed it. It really throws that table off, so thanks for the report!

The diff is:
-|++\++|=|Bitwise "or"|++a\|=b++|++a=(a\|b)++
+|++\|=++|Bitwise "or"|++a\|=b++|++a=(a\|b)++

The correct table row should be:
|= Bitwise "or" a|=b a=(a|b)

Luca Balsanelli  Jan 28, 2020 
Page 303
last paragraph

The name of the variable is $# but is shown in the text as ${}.

Notice this is the same error as posted by Andy Lester on Jan 09, 2020.

Note from the Author or Editor:
First, we're really sorry we never got back to this! We try to keep up on errata (we get emails), but somehow a number of them slipped through.

This is verified, and it's a known issue we have with how the tool-chain renders Asciidoc, as also note in the "Andy Lester page 112" errata. I just fixed this one also, and looked for others but didn't find any. Thanks for the report!

Luca Balsanelli  Mar 02, 2020