Skip to content

Unix shell fun

August 3, 2013

I finally learned about zsh, thanks to a guy named Dietrich Featherston. It’s funny how some of the tools or habits we adopt can stay with us for so long and we often barely think about them. My shell of choice ‘back in the day’ (late 90s-ish) was usually tcsh. The choices we had back then seemed to be primarily Korn shell (ksh) and C shell (csh), of which tcsh was an enhanced version. Of course, you could use Bourne shell, aka the trusty /bin/sh, but it was far more primitive and few people aside from the communists at the Free Software Foundation (kidding) had heard of Bash (and consequently few people were aware just how bad the pun was that was used to inspire its name). So how did one decide which shell to use?  Well, Korn shell had a slightly icky sounding name, so that was one strike against it.  C shell sounded like it was more like C, and it’s true that csh scripts have a syntax that is closer to C. (Maybe C is to csh as Java is to Javascript?) In any case, csh and tcsh had a nifty feature called ‘file completion’ which meant you could hit the escape key and the name of the file or command would automatically be filled in for you on the command line. This was heady stuff, you guys. As far as I remember, this wasn’t a feature offered by ksh at the time and it certainly wasn’t present in most versions of Bourne shell (/bin/sh) that were installed on the various [Unixes/Unices/Unixen] to which I had access (SunOS, HP/UX, IBM AIX, SGI IRIX were the main ones that I recall). It turns out that the developer of tcsh borrowed this feature from the TENEX operating system built by Digital Equipment Corporation (DEC) and that’s where the ‘t’ in tcsh comes from. In fact, normal csh had the file completion feature but it was usually disabled by default, so you had to type ‘set filec’ to enable it. tcsh had file completion enabled by default, so it became easier to use it as a default whenever I had the choice. It also took me a long time to adapt to using tab as the file completion keystroke, though using tab does seem to make more sense now.

Anyway…. back to my current fun. I just installed zsh and also oh-my-zsh, which is pretty nifty stuff since I hadn’t given much thought to updating my shell in a long time. Most recently, I had updated my bash prompt (only using bash out of pure laziness since it’s the default on OS X) to show the current git branch when in a directory under revision control by Git. Very useful, but it turns out zsh and it’s associated plugins have this feature and many many more. It even has themes, a concept that would have been unheard of ‘back in the day’ when one rarely was connected to a shell or remote system that supported colors well.

So my one customization so far was to modify the default robbyrussell theme and replace the ➜ character with a randomly generated Unicode character that falls in the range between 9856 and 9861 in decimal. In other words, every new terminal window opened is a roll of the dice:

DIE=`echo "\\u"$((RANDOM%6+2680))`

Screen Shot 2013-08-03 at 12.32.34 AM

From → Uncategorized

One Comment
  1. Good to know. Googled up this info on zsh with instructions for putting on a mac. May have to try.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: