Author: Dave Taylor & Brandon Perry
Publisher: No Starch Press
Date: November 2016
Audience: Anyone administering UNIX or Linux machines
Reviewer: Kay Ewbank
This is the latest edition of a book of shell scripts for UNIX and Linux, with a very practical approach and lots of usable scripts for customization. The authors say they're fun too, and it is an enjoyable read.
As some readers of the book won't have written scripts before, the book starts with a Shell Scripts crash course on the syntax of bash scripts and how to use them. However, this is very much a book aimed at 'this is how to do task xx', rather than 'learn to program using shell scripts'. The scripts do start off relatively simple and get more complex, and as a programmer you do learn about the power bash has to offer, but you wouldn't want to learn to program using either bash or this book.
The scripts are all followed by a paragraph explaining what the clever bit of it is, but again, this is more about showing how to achieve a result rather than teaching you what a particular command does. That's not a criticism; this is a book showing how to do clever stuff using bash, and it's very good at that. The descriptions also cover how you could 'hack' the script to suit your own specific needs.
Once through the crash course, a useful chapter titled 'the missing code library' is next, which looks at tools and techniques to make it easier to work with shell scripts in the absence of the libraries you get with most programming environments.
The main body of the book is a set of chapters covering things you might want to automate using scripts - starting with managing local users and managing web users. There are scripts for tasks such as disk usage analysis, emailing users who are over their quota, a crosstab validator and a script for extracting URLs from web pages.
Two chapters of scripts are dedicated to administering internet-facing servers, with scripts including how to identify broken web links, and analyzing aspects of a web server traffic log.
A chapter on OS X specifically is next, which Taylor describes as hiding complete UNIX behind the pretty interface; you get the distinct feeling he'd ditch the pretty bit given half a chance! Gems in this chapter include a screen capture tool, scripts to interact with iTunes, and to change the Terminal window titles.
Working with the cloud is new in this edition, with scripts for working with services such as iCloud, Dropbox and Google Drive. There's a chapter on ImageMagik and working with graphics files showing how to do things such as frame and watermark images. A final chapter covers working with days and dates, with scripts for tasks such as finding out how far apart two dates are, or what day a date fell on.
The book closes with a chapter on installing bash on Windows 10, in response to Microsoft's decision to release a full bash system for Windows 10 this year.
Overall, this is an excellent book if you want some ideas and inspiration on what's made possible by writing bash scripts. There are some really interesting techniques, and the book is fun to read.
To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on, Twitter, Facebook, Google+ or Linkedin.