Classic Shell Scripting - Arnold Robbins [4]
Software tool design concepts and principles
A number of principles guide the design and implementation of good software tools. We'll explain those principles to you and show them to you in use throughout the book.
What the Unix tools are
A core set of Unix tools are used over and over again when shell scripting. We cover the basics of the shell and regular expressions, and present each core tool within the context of a particular kind of problem. Besides covering what the tools do, for each tool we show you why it exists and why it has particular options.
Learning Unix is an introduction to Unix systems, serving as a primer to bring someone with no Unix experience up to speed as a basic user. By contrast, Unix in a Nutshell covers the broad swath of Unix utilities, with little or no guidance as to when and how to use a particular tool. Our goal is to bridge the gap between these two books: we teach you how to exploit the facilities your Unix system offers you to get your job done quickly, effectively, and (we hope) elegantly.
How to combine the tools to get your job done
In shell scripting, it really is true that "the whole is greater than the sum of its parts." By using the shell as "glue" to combine individual tools, you can accomplish some amazing things, with little effort.
About popular extensions to standard tools
If you are using a GNU/Linux or BSD-derived system, it is quite likely that your tools have additional, useful features and/or options. We cover those as well.
About indispensable nonstandard tools
Some programs are not "standard" on most traditional Unix systems, but are nevertheless too useful to do without. Where appropriate, these are covered as well, including information about where to get them.
For longtime Unix developers and administrators, the software tools philosophy is nothing new. However, the books that popularized it, while still being worthwhile reading, are all on the order of 20 years old, or older! Unix systems have changed since these books were written, in a variety of ways. Thus, we felt it was time for an updated presentation of these ideas, using modern versions of the tools and current systems for our examples. Here are the highlights of our approach:
Our presentation is POSIX-based. "POSIX" is the short name for a series of formal standards describing a portable operating system environment, at the programmatic level (C, C++, Ada, Fortran) and at the level of the shell and utilities. The POSIX standards have been largely successful at giving developers a fighting chance at making both their programs and their shell scripts portable across a range of systems from different vendors. We present the shell language, and each tool and its most useful options, as described in the most recent POSIX standard.
The official name for the standard is IEEE Std. 1003.1-2001.[3] This standard includes several optional parts, the most important of which are the X/Open System Interface (XSI) specifications. These features document a fuller range of historical Unix system behaviors. Where it's important, we'll note changes between the current standard and the earlier 1992 standard, and also mention XSI-related features. A good starting place for Unix-related standards is http://www.unix.org/.[4]
The home page for the Single UNIX Specification is http://www.unix.org/version3/. Online access to the current standard is available, but requires registration at http://www.unix.org/version3/online.html.
Occasionally, the standard leaves a particular behavior as "unspecified."