Expert Shell Scripting

  • Author: Ron Peters
  • Publisher: Apress
  • ISBN: 978-1-4302-1841-8
  • Pages: 293
  • Home Page:
  • Published: January 2009
  • User level: Intermediate-Advanced

Target Audience

The publisher's road-map for this book is after two levels of their own Shell scripting books. It is stated quite clearly that the book does not teach Shell scripting - to use the book you must know the basics of Shell scripting. The book only discusses the Bourne family of shells: such as Sh; Bash and Korn Shell. The book does not explicitly discuss the differences between the various Bourne family shells or the related POSIX standard, it is assumed that the reader understands this already. In places where the shells differ and different approaches can be tried, the various alternatives are discussed.

Book Structure

The book is divided into three main parts and a set of appendices:

  • Part 1: Basic Scripting Techniques:
    • Chapters: 10
    • Pages: ~73
  • Part 2: System Integration and Advanced Techniques:
    • Chapters: 19
    • Pages: ~117
  • Part 3: Useful Scripts:
    • Chapters: 12
    • Pages: ~79

Book Style

The author's writing style is in the active voice and it feels personal and friendly. All code examples are short and in a clear fixed with typeface - nothing long and complex to type in. The book is very reminiscent in style to an O'Reilly Media's Cookbook type book: the books is made up of small examples and discussions around the example.

Main Content

The book provides a wide range of recipes covering a wide range of topics. Most of them are applicable to any modern Unix/Linux system, tough there is a clear bias in favour of modern open-source tools that may not be available on older proprietary Unix systems. Some of the example while valid as discussion points are not viable solutions as there are standard solutions available that are readily available and supported that provide a more complete solution (Chapters 39 and 40).

Expert Caveat

I have in the past reviewed other "Expert" books and like this one I find that some of the content is new and exciting while some of the content is basic and rather dull. Worst off all I'm left feeling that I'm missing something but frustratingly I don't know what! Books of this level are very depended on your background and I would strongly advise any prospective purchaser to scan the book carefully before buying as this could be a brilliant book for you - or not. The publisher provides a detailed table of contents which I would recommend any prospective buyer to read, or better still please look at the book in a book shop.

Reference Shortcomings

This book is not a reference book and as to be expected further reading is required should the reader wish to delve deeper into any topics highlighted in the book. The one page bibliography is woefully inadequate it misses obvious books from other publishers and doesn't even include books from the publishers own portfolio. The following books are obvious exceptions:

  • Introduction to Shell Scripting:
    • Learning the bash Shell (3rd Edition): Unix Shell Programming. By Cameron Newham, Bill Rosenblatt. 0-596-00965-8
    • Learning the Korn Shell (2nd Edition). By Bill Rosenblatt, Arnold Robbins. 0-596-00195-9
  • Alternative "recipe" books:
    • bash Cookbook: Solutions and Examples for bash Users. By Carl Albing, JP Vossen, Cameron Newham. 0-596-52678-4
    • Shell Scripting Recipes: A problem-Solution Approach. By C. F. A. Johnson. 1-59059-471-1
  • A good intermediate scripting book (lots of sed and Awk):
    • Classic Shell Scripting: Hidden Commands that Unlock the Power of Unix. By Arnold Robbins, Nelson H.F. Beebe. 0-596-00595-4

Reviewer's Opinion

It is very hard to not compare this to the very similar "bash Cookbook" by Albing et al. or "Shell Scripting Recipes" by Johnson both of which are longer books - Albing's is twice the number of pages - and both are heavy weight competition. All books have similar street prices and while this book is youngest, Shell is a mature technology that has not changed a great deal since the earliest of the book to be published. The books are different: Albing's book is Bash specific but it covers Bash's use as a user shell as well as a scripting language; whereas both Johnson and Peters books are targeted only at scripting but covers Bourne Shells not just the Bash version. Albing and Peters use many small examples but Johnson uses fewer examples with longer discussions.

This is an interesting book but personally I found it too basic to warrant the term "Expert", however if viewed as an intermediate level book it is a perfectly viable alternative to the "bash Cookbook".

The level of the book varies - not uncommon with a book of this type and level, for example chapter 6 is very basic content that any introductory book should cover, chapter 9 is another very basic chapter except here the author is trying to warn of hidden problems that can trap the naive scriptwriter.

Chapter 15 is an example of a chapter I was not satisfied with. It deals with the shell's command line history. It starts with a comparison to the DOSKey found on Microsoft DOS systems which I found a very poor example, most new to Linux users (the books target audience) probably have never used DOS as it was superseded by Windows more than decade ago. The chapter then discusses the two editing modes vi & Emacs where the author explains the vi mode and how to set it. Given that Emacs mode is default it is odd that the author has not put forward at the start of the chapter or really explained the benefits of vi over Emacs.

This is not a bad book, it is however very experience dependant and like all recipe books it may not cover what you are interested in. With all books of this type I would strongly recommend a good look at the full table of contents before buying to make sure it covers the topics you are interested in. Though a shorter book, I believe it is a better book than the Johnson book because this is made up of smaller more useful sections.