Introduction: The book does not attempt to teach shell scripting. For that, you are referred to the shell documentation and several pages of web based resources. The intended audience appears to be someone who is already familiar with at least some basic shell scripting but who doesn't want to "re-invent the wheel" and just wants a script that will do the job.
Its 20 chapters cover just about every imaginable shell scripting task and some you may have thought couldn't be done with the shell like filtering spam from your email or doing floating point math.
Comments: The author's scripts make extensive use of features of the POSIX shell, but he does call on external programs rather than unduly complicate a script just to prove it can be done with just builtin shell commands. It turns out to be a nice balance of task assignments. One very unique approach is used in writing functions: two functions are written, one to print the function result value and the other to set a variable. eg:
_mul()
{
_MUL=$(( $1 * $2 ))
}
mul()
{
_mul "$@" && printf "%s\n" "$_MUL"
}
Now one can print the result with
$ mul 12 13 156or just store the result in a variable with
$ _mul 12 13 $ product=$_MULThis is faster than using command substitution to assign the value with:
{ product=$(mul 12 13); }
because, as the author points out, in a situation where the script loops
thousands of times, the time savings is significant.
Conclusion: One thing is certain. If you use this book (and I do) you will certainly learn shell scripting because in order to get the scripts working, you will have to get rid of all the errors. Neither the book nor the downloadable source code seem to have met a proof reader. For example, most of the downloadable scripts do not work "out of the box" because they have filenames other than the ones used to invoke them. On page 18 of the book the _mul() function throws a syntax error. On page 19 of the book is stated "After defining the functions, the library loads standard_vars shown earlier in this chapter: . standard-vars" In fact, neither standard_vars or standard-vars is sourced by the standard-funcs library. You have to add that code yourself (and it's standard-vars, not standard_vars). That's the kind of sloppy editing found throughout the book.
Here is another example from page 11:
Using both the caret and the dollar sign, we can match lines beginning with
J and ending with y:
$ printf "%s\n" January February March " " May June July | grep
'^J.*y'
If you can find the dollar sign, good for you. I can't
Nevertheless, the book is a treasure trove of scripts. If shell scripting is in your box of tools, buy this book and keep it within arms reach. It will save you from walking across the room to get it several times a day.