about | contact | disclaimer | home
What I did not have to miss after giving my Linux-running Inspiron to my brother and purchasing my iBook G4 a while back was the joy of of a bash shell. Or rather, just bash, since otherwise it would be Bourne Again Shell shell. ATM machine, PIN number ... the the tar tar pits.
The relative merits of bash, sh, ksk, zsh, csh, tcsh and the rest can be argued, although as far as I'm concerned it comes down to bash and zsh, since zsh replaces ksh, bash replaces sh, and arguing for the interactive use of csh or tcsh is a sign of mental illness.
I use bash, I admit, because it is what I know; the admirer of nifty technology in me whispers in my ear about zsh, but I haven't yet found a good enough reason to expend effort in learning it and thus switch.
The next step after using the shell for day-to-day computing is first putting a few aliases in .profile and second creating a growing directory of short scripts that, like aliases, function as shorthand for common operations.
Many of mine are just recorded and often used for i in ... loops, such as resizing a bunch of digital photos, creating a directory of thumbnails, or doing batch text edits.
A couple waste-of-time ones are simple factorial and Fibonacci number generators. The joy of these is that they are rather simple math, but at the same time the particular algorithms used, while straight forward, are rather inefficient.
I have this desire to write more complex scripts, mostly for fun. Practical examples and applications, including some specific to Mac OS X, can be found in Dave Taylor's Wicked Cool Shell Scripts (San Francisco: No Starch Press, 2004), though while I've read the book cover-to-cover I haven't actually used any of his projects. On the other hand I do have a need to write some more complex scripts, mostly for the sake of easing file management.
In particular I need to improve my knowledge of regular expressions; I can do the absolute basics, but the more complex pattern matching is stuff I haven't played with.
The other day I realized that tree $music_directory | grep ".mp3" | wc -l was a quick and dirty way to count how many mp3 files you have in a directory tree.
I need to refresh my memory regarding the commandline tools for extracting meta data from image files (identify $file_name is a beginning, piping to awk to collect only the relevant information) and for altering the creation date for a file (I believe it is touch—I have some images from my digital camera that have the wrong timestamps because I forgot for a while to reset the date/time on the camera when I returned to the U.S. from Berlin), as well as for altering the meta data within a jpg (in particular creation date/time).
—January 18 2007