At first I used
stat -c %i file (to help detect the presence of a jail), which seemed to work on any Linux distribution under the sun. On OS X' I had to use
ls -i file | cut -d ' ' -f 1.
Is there some way to find the inode number of a file in a shell script which is portable across *nix platforms and does not depend on the notoriously capricious