Jul 19

Various quotes, mostly UNIX related, which I’ve accrued over the years from various sources.

Well my terminal’s locked up and I ain’t got any Mail
And I can’t recall the last time that my program didn’t fail
I’ve got stacks in my structs, I’ve got arrays in my queues
I’ve got those: Segmentation violation — Core dumped blues.

The wonderful thing about standards is that there are so many of them to choose from.

– Grace Murray Hopper

Ken Thompson has an automobile which he helped design. Unlike most automobiles it has neither speedometer, nor gas gauge, nor any of the other numerous lights which plague the modern driver. Rather, if the driver makes a mistake, a giant “?” lights up in the corner of the dashboard. “The experienced driver”, says Thompson, “will usually know what’s wrong”.

– Anonymous

The problem with sendmail is that the sendmail configuration file is a rule based expert system, but the world of email is not logical and sendmail configuration editors are not experts.

– David Waitzman, BBN

Continue reading »

Jul 19

While I was playing with AppleScript earlier this week I wanted to run a shell script I’d written from within Finder rather than from a shell prompt in Terminal.app.

On Windows I tend to write scripts to run under Cygwin and then write a wrapper batch file to run the script under the control of Cygwin’s bash executable.

Turns out the AppleScript solution is identical in principal and is as simple as

do shell script "/full/path/to/shell/script"

You may need to adjust the path to the script dependent upon whether the directory where your script resides is in your $PATH or not.

Jul 13

One of my standard lunchtime reading web sites started me off on this; The Unofficial Apple Weblog got me reading an article on PC Magazine’s site about Argh! moments. That sort of moment when you try to do something really simple on OS X but find it isn’t. In this case, Robyn Peterson’s struggle to mount a network volume on login struck a chord. I’d gone down a similar route and come up with an alias to a network volume in my login items, a solution which seems to be well documented after a quick Google search.

But this wasn’t quite enough for me; my main Mac is an iBook and that means I access network volumes at home and at work so automatic reconnection to a non existant volume at home when I connect my iBook to my employer’s corporate LAN wasn’t really a solution. But from Robyn’s article I decided to take the plunge and write my first AppleScript.

Maybe write is too strong a word; I found the script I needed almost verbatim on the MacFixIt forums. All I needed to do was modify it to my own ends.

Firstly I needed Apple’s Script Editor, which lives in /Applications/AppleScript; then I was able to enter the following script.

tell application "Finder"
open location "smb://user:password@server/share"
end tell

A few words of explanation. Firstly the names have been changed to protect the innocent so I’m not using a real user name, server name or share name and I’m most definately not using a real password. Secondly the network volume I’m connecting to is on a machine running Fedora Core and which is made available to the network using Samba, hence the smb: part of the URI.

I then saved the script somewhere meaningful; I keep a directory called Scripts which unsurprisingly contains scripts so that seemed as good a place as any. I also made sure that when saving the script I saved it as an application and not a script to prevent me being prompted whether I wanted the script to run each time I ran it, as well as ensuring that the Run Only, Startup Screen and Stay Open check boxes were deselected.

Then it was a simple matter to run the script either from a Finder window or via Spotlight and my network volume mounted and was available.