Book Reviews

My views about what I read, often programming slanted.

24

JAN
2008

From Bash to Z Shell

I work on multiple Unix platforms all day long. I had never really taken the time to learn about the shells, but I had picked up the basics over time. I knew how to run commands, string them together with pipes, and redirect their output into files. So when I tell you that I started learning new things in the first chapter of From Bash to Z Shell, you will know the coverage is in depth. If you are a casual shell user, or even less experienced, this book has a lot to offer you.

From Bash to Z Shell is organized into three parts. Part one is an introduction to shell basics. It focuses on typical interactions with a shell including all of the things I mentioned knowing before reading this book. There is surprisingly good depth even here though and I doubt that anyone short of a power user could make it through this section without picking up a new trick or two. I learned multiple things from each chapter in this section.

In part two, each chapter takes a single aspect of the shells and really focuses in on just that. You will find chapters about the startup files each shell invokes as well as shell command histories. This is comprehensive coverage that really gets you to understand how things work as well as how to tune them to your personal tastes. You are even less likely to not pickup great tips in here.

The third and final part of the book turns to shell programming. While I suspect that plenty of users interact with a shell regularly without getting much into scripting them, there are still useful tidbits in here for them too. For example, after reading this section, I added some code to my startup file to customize my shell's completion functionality. I can now tab-complete the server names used by my workplace and even file system paths on those servers. This section also has a very good chapter on variables that will definitely help in day to day usage. A couple of the final chapters in here are heavily slanted towards or exclusively about the Z Shell though, so those chapters don't hold much for users of other shells.

As the title suggests, the book extensively covers both the Bash shell, which seems to be the standard default on many Unix systems now, and the feature-rich Z Shell that power users seem to favor. Surprisingly though, the book does talk about many other shells. In the first part especially, features tend to be described for more than just the two shells with top billing. This falls off in the later parts to some extent though. Also, the authors clearly aren't fans of the C Shell or its derivative the T C-Shell, so fans of those will want to look elsewhere. Windows receives some screen time, but only from the angle of running Unix-like environments and shells on it. You won't find coverage of the native Windows shells in these pages.

The book is quite good at covering the similarities of the shells. They frequently tell you when some command will work unchanged in both Bash and the Z Shell and they always do their best to give two equivalent commands when there are differences. This makes the shell knowledge you pick up from reading quite portable. It's also nice for those who don't know much about the differences between the shells and thus are trying to learn enough to pick the right one for them. It helped me choose a favorite. The only downside of this is that the transitions seem to become less smooth late in the book and I found myself wondering if we were still talking about Bash or had moved on to Z Shell a few times. This is a minor complaint though.

Beyond covering the shells well, the book can also help you better understand the design of the Unix operating system. It has some great asides on things like process forking and child process inheritance, special files and devices, and terminal drivers. Seeing these items through their interactions with a shell can make them significantly easier to grasp.

The writing style of this book is very natural. That's important since it distills so much information into every page, you could easily begin to feel overwhelmed. Luckily, that wasn't the case at all for me. I found the material to be presented so naturally that I absorbed it with ease. The book also has abundant cross references and a strong index which will make it great to reference later.

The final measure of a book like this turns out to be how much it changed your daily work habits. I've already noticed dramatic differences. I'm using shell loops at the command-line now to process many files at once; I actually understand shell quoting and when to use which types of quotes and escapes to get the desired effect; I can easily strip off a file extension or get a directory name from a full path when I need one; I make constant use of the command history now whether I'm searching for a past command, correcting a typo, or just pulling a single argument out of a previous command for reuse in a new command; and I've written a few shell functions to provide shortcuts to my common tasks. I just naturally began doing these things too, I didn't have to work at it a lot. From Bash to Z Shell just raised my understanding that much. To me, that's a big selling point.

From Bash to Z Shell

Comments (6)
  1. Ryan Ballantyne
    Ryan Ballantyne February 13th, 2008 Reply Link

    What, no Amazon referral link? :P

    1. Reply (using GitHub Flavored Markdown)

      Comments on this blog are moderated. Spam is removed, formatting is fixed, and there's a zero tolerance policy on intolerance.

      Ajax loader
    2. James Edward Gray II
      James Edward Gray II February 13th, 2008 Reply Link

      Wow, I never expected to see that as a (semi-)complaint! :)

      1. Reply (using GitHub Flavored Markdown)

        Comments on this blog are moderated. Spam is removed, formatting is fixed, and there's a zero tolerance policy on intolerance.

        Ajax loader
    3. James Edward Gray II
      James Edward Gray II February 13th, 2008 Reply Link

      Multiple readers have requested the links now, so I will add them in the future.

      1. Reply (using GitHub Flavored Markdown)

        Comments on this blog are moderated. Spam is removed, formatting is fixed, and there's a zero tolerance policy on intolerance.

        Ajax loader
  2. Andy Stewart
    Andy Stewart February 27th, 2008 Reply Link

    Thanks for describing this book. I wasn't aware of it but bought it on the strength of your review, and started learning useful things immediately. Yay!

    1. Reply (using GitHub Flavored Markdown)

      Comments on this blog are moderated. Spam is removed, formatting is fixed, and there's a zero tolerance policy on intolerance.

      Ajax loader
  3. Mein
    Mein May 21st, 2011 Reply Link

    Nice. Do you think this book would still be relevant today (May 2011) ? I'm coming from the camp that I've learnt bit and pieces of bash in the last 4 months (was a complete newbie before that).

    1. Reply (using GitHub Flavored Markdown)

      Comments on this blog are moderated. Spam is removed, formatting is fixed, and there's a zero tolerance policy on intolerance.

      Ajax loader
    2. James Edward Gray II

      It's still very relevant, yes. It will school you in how to use either shell. That's always useful.

      1. Reply (using GitHub Flavored Markdown)

        Comments on this blog are moderated. Spam is removed, formatting is fixed, and there's a zero tolerance policy on intolerance.

        Ajax loader
Leave a Comment (using GitHub Flavored Markdown)

Comments on this blog are moderated. Spam is removed, formatting is fixed, and there's a zero tolerance policy on intolerance.

Ajax loader