Errata

bash Idioms

Errata for bash Idioms

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 26
Near bottom of code block

There is a missing single quote in `echo '` in the line after callout 15. Somehow I managed to accidentally delete it while doing copyediting revision. It is already fixed in the electronic versions and in the examples on Github, but the first print edition had already gone to the printer when I caught it.

JP Vossen  Mar 26, 2022 
Page 34
Suffix removal table

In the table of examples showing the various ways to remove from the right side of the string, the filename "img.1231.jpg" gets abbreviated to "img.1234" instead of "img.1231".

Note from the Author or Editor:
Correct, thanks for catching that. I've changed both instances of the slightly odd "1231" to "1234" to match the answer in the repo, since that seems a simpler and more expected pattern.

[master fdd190f] ch04:includes/suffix.csv: "1231" vs. "1234" bugfix per errata from Andy Lester

Andy Lester  Jul 07, 2022 
Page 37
Middle of table of parameter expansions

${var:-default} is listed twice, with two different definitions. The second occurrence should be ${var:=default}.

Note from the Author or Editor:
Nice catch, thank you! I have fixed that in the repo and pushed the fix to O'Reilly and Github.

Macon Gambill  Apr 16, 2022 
Page 86
Top of page (pipeline starting with grep)

The first example on page 86 is identical to the last example on page 85, meaning it won't produce the expected output if executed as shown. I imagine the intent was to remove the -d':' argument from the read command and instead use prefix assignment to set IFS to ':', e.g.:

grep '^nobody' /etc/passwd | { \
IFS=':' read user shadow uid gid gecos home shell; \
echo "$user | $shadow | $uid | $gid | $gecos | $home | $shell"; }

Note from the Author or Editor:
You are correct. I've upgraded this one to serious because as written it not only does not work, but it's not at all clear why if fails.

I've committed a fix to the book code, but this one is not in the example code so that is unchanged.

Macon Gambill  Apr 24, 2022 
Page 130
second item under the first bullet point

> And unless you are using ~=, in which case you can't quote the regular expression!

"~=" should be "=~"

Note from the Author or Editor:
Thanks! This is in the a style guide file that is included in 2 places, and used to generate the `bash_idioms_style_guide.html` and `bash_idioms_style_guide.md` docs. I've fixed it in the ORA Git and on Github.

Patrick Brinich-Langlois  Sep 18, 2022 
Page 141
first sentence

"~=" is used instead of "=~"

Note from the Author or Editor:
Thanks! This is in the a style guide file that is included in 2 places, and used to generate the `bash_idioms_style_guide.html` and `bash_idioms_style_guide.md` docs. I've fixed it in the ORA Git and on Github.

Patrick Brinich-Langlois  Sep 18, 2022