Monthly Archives: March 2012

So alike, yet so different

I’ve recently fallen into the world of Mac OS X. (Fallen, pushed; what is difference?)

I keep getting caught out by the little things that are just slightly different to what I’m used to in Linux.

Take the most recent example: the mail command. I had a little anacron script set up on my Ubuntu box that would generate a summary of a previously-unseen messages in a user’s Gmail spam folder, and send it to that user. (Mostly because Mrs E kept forgetting to check hers.)

While I was perusing the mail man page on Mac OS X, and reading up on various options on Google, I found that the Mac version had a useful -E switch that would allow it to quietly abort if there was no message body, saving me the hassle of having to find a recent port of moreutils so that I could use the ifne command.

The thing that got me stuck for ages was trying to find a replacement for the -a switch in the GNU/Linux version of mail, which allowed the insertion of arbitrary headers, and was useful for setting the sender to something appropriate.

Eventually, after much reading of man pages and search results, I realised that the answer had been staring me in the face for ages, I just wasn’t doing it correctly because the order of the parameters became more important:

echo Wibble | mail -s "Subject goes here" -r "<>" -F "Mail Sender"

That was harder than expected…

(Note to self: WordPress doesn’t tell you that it’s stripping out the content in angle brackets that you’ve just retyped three times…)

Leave a comment

Posted by on Tuesday 13 March 2012 in Geeky stuff


Tags: , , , ,