Why Does BASH Differ Across Different Platforms?

Using the BASH shell in OS X I wanted to examine the EXIF data of my JPG files for a script I am writing. Unfortunately, the exif command in BASH does not work, despite there being a man page for it. I’m solving this problem by using ExifTool by Phil Harvey, but it leaves me asking the question “Why does the BASH exif command work with Linux but not with OS X?” I had a similar problem using the uniq command that works fine with Linux but only partially with OS X:
uniq -w 32
That is because in OS X there is no -w flag. Most of the scripts and examples I find to learn from are written in BASH with Linux and I’m having a really hard time understanding why BASH is not the same with OS X. It makes no sense.

Anyone?

UPDATE 10/07/08

In fact, you don’t get exif on Linux so what am I talking about (and there isn’t even a man page for it like on OS X). Use exiv2 or exiftool. Still confusing why it’s there in OS X though..

Ubuntu 7.10 & Mounting As Read-Write A Firewire Drive Formatted As HFS+ (Mac OS Extended) Journaled

Solution

1. Disable Journalling for the HFS+ drive you wish to mount.

To do this, with your drive connected in OS X Terminal type (replacing yourvolume with the correct drive name):

diskutil disableJournal /Volumes/yourvolume

2. Start Ubuntu, plug in your drive if you unplugged it and the drive will mount as Read-Write.

N.B Please read on to see why I recommend turning off journaling using terminal and not disc utility.

You can read more about what Journaling is here.

Background Information

Firewire Drives Formatted as HFS+ (Mac OS Extended) Journaled will not mount under Ubuntu 7.10 (see here). I find this odd because I have my single internal hard drive partitioned into 3 (1 ext3 for Ubuntu, 1 HFS+J for OSX and 1 HFS+J for storage) and running Ubuntu I can mount both of these drives with no problems, but a HFS+J Firewire drive will not mount.

Fortunately if the drive is formatted as pretty much anything else it will mount under Ubuntu 7.10. This includes HFS+(Mac OS Extended) Non Journaled. I moved everything over to another drive, reformatted the drive as non journaled. Of course on reading this I found I could have just turned journaling off in the file menu of OSX Disc Utility without formatting my drive and moving my data all over the place. Oh well.

This worked fine and my drive mounted as rw allowing me to read files and save a file to the drive.

However after this initial spell of success the drive became read only. Going back to here “the driver will refuse to mount the filesystem read/write if it was not cleanly unmounted” and then looking here “If it ever occurs where your system is locked up and you have to force reboot, then the HFSplus disk will not be cleanly unmounted” and I did indeed restart my machine.

So my next step was to check the drive using OSX, repair permissions, turn on then off journalling then try the drive on Ubuntu again. If that doesn’t work, I’ll follow the information here to do this in Ubuntu.

As the instructions indicate, there is some kind of error with Disk Utility under OSX whereby being able to enable and disable journalling does not work correctly. I could turn journalling on but not off but using the following command in terminal in OSX works (and can be seen to work in Disk Utility if you have it open):

diskutil disableJournal /Volumes/yourvolume

N.B The command is spelt wrong (diskuilt instead of diskutil) on the instruction pages refered to above here so don’t copy it.

The drive then mounted as rw in Ubuntu (I started up with the drive plugged in) - I could read, write and delete files. I then right clicked the drive, unmounted it and restarted. The drive again worked fine as rw. I then restarted without first unmounting the drive. This also worked fine. This is good news as under normal conditions the drive seems to mount as rw fine. I think the disk check at start up may cause problems as I went through one. I should induce that again to check, but for now I’m running my script at last.

I wanted to do all this because I have been trying for some time to run a duplicate removal script on my drive which uses the uniq command with the -w flag. This is not included in Darwin bash on OSX and I don’t have enough experience to port the script over which effectively forces me to work out how to read/write this drive on Ubuntu. Needless to say I have had many obsticals; more here (when i write it).

Naked Ubuntu

I found these images searching for Ubuntu using Google Images.

http://robitaille.files.wordpress.com/2007/04/oct.jpghttp://robitaille.files.wordpress.com/2007/04/mar.jpg

Ubuntu apparently caused a little controversy a few years ago with art work for the 4.10 (Warty) release that depicted naked people. I can’t see any problems. There’s no balls and you can change it.. Full story here.

Along an almost similar line (similar enough for google images anyway):

http://upload.wikimedia.org/wikipedia/commons/d/df/Body_painting.JPG

Next Page »