Technical Thing For The Day: Achieved!

Today I learned how to write shell scripts - or that is, I wrote my first shell script that didn't involve a straight cut-and-paste from my .history file. (for my parents: a ".history file" is something that contains the last bunch of commands you've typed into your computer, and is useful for going back and figuring out what you've just done... sort of like an instant replay.)

I spent way too long tracking down Boston-area housing for the ILXO
people who will be in the Chicago office with me this summer (they're
going to be at 1cc for a while for training), so going to count this script because it's the only tech thing I've got to show for today. (So far.) The script itself was written in little bits and pieces during a meeting when I couldn't hear the people who were talking; it's a quick hack.

It's a content bundle making script that I whipped up for Chris, who was working on creating health content bundles from MedLinePlus. Basically, if you point the script at an "index.html-like" page on the web that has links to articles and files that you'd like to include in a bundle, the script will download that page and all the files it points to, generate library metadata for the XO to interpret, then pack it all up in an .xol library bundle file.

Writing shell scripts is surprisingly easy. I was psyching myself up for it to be hard and all sorts of elaborate arcana. I should not do that. It is not hard. Really, you just type in the commands you'd type into the shell, use $variables in appropriate places, and look up the proper syntax for simple logic loops (one nitpick: I wish they'd use mathematical notation for boolean logic instead of making me remember that "-ne" means "not equals" instead of the "!=" I'm used to. This is entirely my fault, as I am a creature of habit).

The script could use improvement - more to the point, my script-writing-fu could use improvement as there are kludges in there I'm not satisfied with (for instance, the section that creates a library.info is incredibly brittle; it just concatenates the appropriate lines into a text file), so comments and changes and pointers to cool examples of good script-writing practice are super-welcome.

Perhaps I should go back to visit NYC and get my copy of Beautiful Code back from Ethan someday. That has some gorgeous code to read.