Shell Scripting

Expert Recipes for Linux, Bash and more

Published in August 2011, Shell Scripting: Expert Recipes for Linux, Bash and more is a 600-page book on Shell Scripting for the intermediate to advanced reader. Largely focussed on Linux and the Bash shell (including Bash version 4), it covers all Unix flavours, includes a lot of information about the Bourne shell and relevant to all Bourne-compatible shells, as well as giving an overview of the different shells available.

UK Readers can buy here - USA Readers can buy here. Also on Kindle, iPad, Nook; just use your native search tool to find it for your preferred platform.

The first half of the book covers the theory and principles, with realistic examples provided as recipes for each feature. The second half of the book provides solid, real-world recipes which can be used as-is, or taken as a starting point to write similar scripts to fit the tasks a systems administrator faces day to day.

Chapter Outline

The full Table of Contents [pdf] is 12 pages long, but this table shows the basic layout. The first half of the book is tutorial style, the second half consists of recipes with detailed discussion about the design and structure of each recipe.
Part I - Language and UsagePage
Chapter 1History3
Chapter 2Getting Started15
Chapter 3Variables33
Chapter 4Wildcard Expansion67
Chapter 5Conditional Execution83
Chapter 6Loops111
Chapter 7Variables Continued139
Chapter 8Functions and Libraries161
Chapter 9Arrays199
Chapter 10Processes219
Chapter 11Choosing and Using Shells255
Part II - Recipes for Using and Extending System Tools
Chapter 12File Manipulation279
Chapter 13Text Manipulation315
Chapter 14Tools For Systems Administration353
Part III - Recipes for Systems Administration
Chapter 15Shell Features
  Recipe 15-1: Installing Init Scripts
  Recipe 15-2: RPM Report
  Recipe 15-3: Postinstall Scripts
Chapter 16Systems Administration
  Recipe 16-1: Init Scripts
  Recipe 16-2: CGI Scripts
  Recipe 16-3: Configuration Files
  Recipe 16-4: Locks
Chapter 17Presentation
  Recipe 17-1: Space Game
Chapter 18Data Storage and Retrieval
  Recipe 18-1: Parsing HTML
  Recipe 18-2: CSV Formatting
Chapter 19Numbers
  Recipe 19-1: The Fibonacci Sequence
  Recipe 19-2: PXE Booting
Chapter 20Processes
  Recipe 20-1: Process Control
Chapter 21Internationalization
  Recipe 21-1: Internationalization
Part IV - Appendix
AppendixFurther Reading; Shell Tutorials, Documentation, Shell Services, Glossary529

To Buy the Book

To buy the book from Amazon, simply click on its image in the panel on the right hand side of this page, or from your preferred supplier via You should also be able to find it on the High Street from your favourite bookstore, as well as in electronic format (Safari, iPad, Kindle, etc), or just search for 1118024486.

Publisher's Page is the publisher's page for the book, with more information, international prices, and more details. It also contains links to download the first chapter, the Table of Contents and the Index. You can also download the code from that page.
You can get the book from various bookstores via, or just use your favourite search engine, or ask your local bookstore for ISBN 1118024486.