Thursday, January 12, 2012

Book Review: bash Cookbook


When I started working with SideReel, I was overjoyed to receive a Macbook Pro as my primary work system. The reason? It meant I'd be able to get re-acquainted with the UNIX shell again after a long time away. Having been a regular user of the shell in the 90s, but having not worked with it regularly for many years, I figured the bash Cookbook would be a good way to get back into the swing of things and update my shell scripting vocabulary.

This is the kind of book that, for all intents and purposes, is impossible to review completely. Generally speaking, these types of books serves two purposes. The first is that it presents a number of questions and issues, and then it provides potential answers. The second is that it works as a kind of roundabout reference guide (and not a complete one). Most people will not, if they are in their right minds, go through each one of these entries and try them serially. They will, instead, keep this book in reserve until they have a particular question, and then look up that solution and extrapolate if it and other associated suggestions may help them achieve a particular goal.


It is with this consideration that I give some well deserved praise for the bash Cookbook. Note, if you are a newcomer to the bash shell, then this is going to be a confusing place to start. If you have worked with other shells and have familiarity with shell programming syntax, and have spent a little time online to learn some of the specifics of how the bash shell responds to user input, handles redirects, and understand some of its basic idiosyncrasies, then this will be a good, and fun,  book to work through and play with.


From basic interactions to advanced level operations and automation, each tip is structured the same way. A Problem is presented to the reader, usually in a one or two line format. The book then presents a Solution based on the previous Problem. Each section then follows with a Discussion that describes the particular technique or recipe in depth. Finally, there is a listing of "See Also" topics that might help inform the development of your scripts. Note, I have purchased the PDF version of this book, and the PDF version has fully indexed all of the "See Also" links to jump to those particular recipes (a wonderful time saver :) ).


The cookbook style is not for everyone. This is not meant to be a pure tutorial guide or a structured reference. The cookbook format is structured to give various examples that, when experimented with, can lead to many jumping off points for your own scripts. Likewise, as with a standard cookbook, users will need to play around with the recipes and see if they will meet their specific needs, or see how much experimentation is required to get their desired result.


Although it is set up in small topic sections, and while the topics do not necessarily blend into each other, the coverage is such that, if you do go through the first several chapters, you will learn a lot about shell interaction and methods of programming the shell. From there, having the ability to cross reference other suggestions in often far distant chapters can be quite helpful and help tie individual tips and tricks together.


Bottom Line:

For those who plan to use any variant of UNIX/Linux and want to be able to master many file related or text manipulation processes, the command line is the way to go. If you have any intention of using the UNIX command line, getting a handle on the many techniques available to users, the teeming number of utilities available, and a varied approach to learning about how to use them to solve particular problems (both general and specific), and bash happens to be your weapon of choice, and perchance you already have a basic familiarity with the process of programming the bash shell, then the bash cookbook would be a good addition to your personal reference library. It's a gift that keeps on giving.

2 comments:

Anonymous said...

Nice and interesting review. I know it isn't the right book for me right now.
Have you an idea of wich book I could start with.

perpipon at( )yahoo dot/fr$

Michael Larsen said...

There are several possible starting points, but inthis age of so much online available content, I'd suggest trying an online resource first. Give this one a try:


Learning the Shell