UKUUG home


(the UK's Unix & Open Systems User Group)






Book Discounts

Other Discounts

Mailing lists






Classic Shell Scripting Arnold Robbins and Nelson Beebe
Published by O'Reilly Media
300 pages
£ 24.95
Published: 24th May 2005
reviewed by Mick Farmer
   in the September 2005 issue (pdf), (html)

I first used UNIX in the mid 1970s, so it must have been version 6, or possibly version 7. The Bourne shell was so radically different from anything I'd used before (VAX Control Language? and something similar on a PDP-15) that I happily wrote scripts before I'd learnt to program in C. Unfortunately, I can't find any of those early scripts, so it's nice to get a book that I can use to check whether I'm still up-to-date in this area.

The first seven chapters cover the basics (Background, Getting Started, Searching and Substitution, Text Processing, Pipelines, Variables and Control Structures, Input & Output) very thoroughly with short examples. A brief introduction to Internationalization (i18n for short) via locales quickly taught me about this important growth area.

I was nodding through these short scripts when one example leapt up and showed me how restricted the UNIX tool set really is for today's world. The tools excel at handling text on a line-by-line basis. Anything with an XML structure (such as HTML) and you're on your own -- the script could only handle tag pairs written on the same line!

In Chapter 8 (Production Scripts) we begin to see some solid work and it was good to notice that option processing is taken seriously, as is error handling with the liberal use of functions.

Chapter 9 is an introduction to awk and chapter 10 was an overview of file handling.

Chapter 11 consists of the first serious example, that of merging the password files on two systems. It is important to get unique UIDs and that the ownership of files is correctly handled. This allows two computers to share their files over NFS. The script is built up piece by piece and the chapter finished with issues that might have to be addressed in the real world.

Chapter 12 covers everything you ever wanted to know about spell checking. It starts with the early UNIX prototypes built from pipelines, continues with a discussion about aspell and ispell, and finishes with a fully-functional spell checker written in awk. An interesting retrospective points out that the authors' 190 lines of awk compares extremely favourably with the GNU ispell (13,500 lines of C) and the GNU aspell (29,500 lines of C and C++).

Chapter 13 is about controlling UNIX processes and points out how the different shells handle processes in subtle, different ways.

This leads on nicely to Chapter 14, which deals with shell portability issues. It also describes the various extensions that have been imported into some shells. My impression is that the shells are converging towards one high-powered scripting language, perhaps one to rival Perl!

Chapter 15, the final one, contains a number of tips for writing secure scripts. I was pleased to see that I knew about most of the tips and even put some of them into practice.

There are three appendices (Writing Manual Pages, Files and Filesystems, Important Unix Commands) which briefly cover those topics. However, I do wonder how many people are going to write manual pages these days.

To summarise, an enjoyable read, but it doesn't contain any information that isn't available elsewhere. I like seeing a script (or any program for that matter) built up, step by step, with a good explanation of what each step is trying to achieve. Use this book, like me, to see if you're still keeping your script writing skills up to scratch.

Back to reviews list

Tel: 01763 273 475
Fax: 01763 273 255
Web: Webmaster
Queries: Ask Here
Join UKUUG Today!

UKUUG Secretariat
More information

Page last modified 02 Apr 2007
Copyright © 1995-2011 UKUUG Ltd.