Putting superstition into Computer Science since 1984

CRAZY Bash Programming with Wayne E. Seguin

I met Wayne E. Seguin at MountainWest RubyConf, and we immediately hit it off, much to the dismay of many onlookers. At one point Evan Light said “It would be interesting to find out which of you two has the most disturbing sense of humor.” Both Wayne and I immediately shouted “OKAY!” and then I didn’t hear what either of us said after that because everyone around us was screaming “NOOOOOOOOOOOOOO!!!!!!!!”

Now, Wayne created the incredible rvm, or “Ruby enVironment Manager”, and what’s more, he created it all in bash rather than using a “real” programming language like Ruby or Python. It turns out that Wayne’s been doing a lot of bash scripting, writing BDSM which doesn’t stand for what you think it stands for and instead stands for “Bash Deployment and Server Manager”. Then again the project image is a penguin dressed in leather cracking a whip over a 4U server wearing a ball gag. So maybe it also means what you think it means.

But I digress. The point is, Wayne’s been doing a LOT of programming in bash lately.

A few weeks ago, I tried to add rvm-prompt to my bash prompt, and found that I couldn’t. I learned enough bash scripting a couple years back to write a totally sweet bash prompt that showed my git branch in different colors based on the name. Master and Production branches show in an alarm color, story branches in a calm cyan, etc, like so:

But while my prompt was sweet, my bash prompt programming was… well, not so sweet. It chained half a dozen sed scripts together to inject the ANSI color codes for each branch name, and like I said, was so complex I could not debug it. I showed it to Wayne with a mutter about “I should probably extract this to a function or something”. Wayne looked at it and made this sort of incoherent cry of alarm and dismay. In his defense, this was the prompt:

A few hours later, he called me on Skype and said, “Can I help you with your bash prompt?” I said “Sure!” and Wayne turned on screen sharing.

What I didn’t know is that he had Haris Amin on the line as well, and he had prepared an entire bash programming lesson for us.

What HE didn’t know is that I have been in the habit of recording my Skype sessions. When Wayne switched us to his Adobe Connect sharing session, I said, “Hang on, you’re not sharing this with Skype, I need to start my OTHER screencast recorder.”

I wish I could say the same about knowing all the tricks, I agree–I knew some of them. I had read about the string manipulations but they never really clicked for me. Wayne is amazing, and I’ll be doing a lot more bash scripting in the days ahead.