The second edition of Unix Shells by Examples shows off basic commands and utilities in the three most popular Unix shells--C, Bourne, and Korn--with side-by-side examples. The new edition of this book is sure to be a worthy reference for Unix programmers for getting around their favorite shell. The best thing in this new edition is that the author presents short, effective examples of using basic commands and utilities for each of the three major Unix shells. This comparative approach means that you can use this book on different flavors of Unix and even migrate scripts between different shells. For each shell, the author provides fundamentals, like accessing profiles, command-line histories, and shell programming. "Lab sections" let you develop your skills with short, hands-on exercises for each shell. As in the earlier edition, the author's short examples show you how to perform basic tasks quickly with common switches and options. Other sections here cover three major Unix grep (for searching), sed (for editing), and awk (for scripting and reporting). (The reference and tutorial on AWK programming is a notable feature here. There is also good coverage of regular expressions.) Instead of hunting down information in countless man pages , this book will save you valuable time every day with its efficient format and comparative approach--truly useful features for the beginning and intermediate Unix user. --Richard Dragan Topics covered : C, Bourne, and Korn Unix shells; grep, sed, and awk utilities; regular expressions; and shell programming.
I came to this book because a new job had moved me from a situation where the people I worked with generally knew what the POSIX standards were, and used Bash (the GNU Bourne-Again Shell) as their default shell (because it is, on most GNU/Linux distributions), to a place where tcsh was the default login shell, but most scripts were written in non-POSIX-compliant sh, with Bashisms and Kornisms all over the place but unacknowledged as such.
Since I saw much cleanup and pedantic explanation of shell differences in my future, I elected to bone up and ensure I had a command of the territory I was entering. I already had many years of POSIX and Bash scripting experience under my belt (and more importantly, I knew the difference). I had used tcsh as well, from 1993 to 1999 or so, and for a time I wrote scripts in sh while continuing to use tcsh as my interactive shell, but eventually succumbed to the lure of a consistent environment.
My bottom line on this title is "adequate"; it does what it sets out to do, which is walk through the features of several shells: historical Bourne (i.e., Solaris's /bin/sh, not fully POSIX-compliant), csh, ksh (some mention of the differences between original ksh, ksh88, and ksh93 is made, but there's no comprehensive breakdown of the differences), bash (2.x was the latest as of this writing), and tcsh.
Appendix B has a sort of comparison/translation table between csh/tcsh, (traditional) sh, ksh, and bash--this is fairly useful.
The examples are sometimes more contrived than practical, and usually duplicated between the chapters as much as possible (which isn't necessarily a bad thing, just worth noting).
Three early chapters cover grep, sed, and awk in a useful but somewhat perfunctory manner. Appendix A similarly breezes through the usual suite of Unix commands that just about every other introductory Unix books covers in the same manner.
Appendix C, a few pages on shell quoting, is very good. Anyone who knows just enough shell syntax to be dangerous should read those pages first, and make sure they've mastered them.
As noted above, there is a fourth edition available now. I presume it covers vesion 3 of bash, and I would avoid that edition if it doesn't.
If I were in charge of writing a new edition of this book, I would:
* Eliminate the coverage of grep, probably in favor of Mastering Regular Expressions by O'Reilly, if people want depth, and a reference card if they don't.
* Eliminate the coverage of sed and awk in favor of O'Reilly's sed & awk.That title fully explores those utilities. A little bit of knowledge of these tools (as presented here) does more harm than good, I fear. I see ignorant stuff like:
* The only widespread system that still ships a pre-POSIX /bin/sh is Solaris. Cover Solaris sh as such, a historical relic, with footnotes to a chapter on POSIX sh.
* Talk about the POSIX.2 standard much, much more.
* Emphasize that csh and tcsh are very poor choices for scripting languages. For example, there is literally no syntax in those shells for redirecting output to standard error, and only standard error. This means that people writing csh/tcsh scripts are likely to write diagnostic messages to standard output instead, which makes them more like MS-DOS batch files running on Unix rather than proper Unix shell scripts.
* Either state at the outset than only one version of a shell (original ksh, ksh88, ksh93, pdksh, for example) will be covered, or be much more scrupulous about documenting which features are and are not available in each version. Same goes for bash 1/2/3.
* Give some coverage to zsh, for crying out loud. It's got enough users to merit some attention, even if it's got so many features one could write a 1000 page back on it alone. As part of the abbreviated coverage, be frank about what is not covered.
I did not remove the CD-ROM from its packaging, and never at any point saw any reason to do so. The disc would seem to just drive up the production cost (and possibly justify goosing the profit margin to "offset" that cost; the back cover claims that the disc contains "the source code and data files for all examples in the book", which is not really an added value given the nature of those examples, which are usually short enough to be typed in in less time than I imagine it would take to pop the disc into a drive and navigate to the file in question. A CD-ROM is much more justified in titles like No Starch Press's "Wicked Cool $FOO Scripts" series and O'Reilly's "$FOO Cookbook" series.
It is thorough but extremely repetitive. Mistakes from earlier editions were still uncorrected in the latest edition. Still, it will definitely allow you to get your head around Regular Expressions and the various text search and manipulation tools available on Unix-like systems.