Improve cross-platform compatibility

When testing on Solaris 10, it was discovered there are quite a few incompatibilities caused by Solaris 10 not using GNU or POSIX-compliant commands by default.

These changes make things more compatible.

This fixes most of the things detailed in https://github.com/github/backup-utils/issues/85 - we just need to decide what we're going to do about the hashbang, if anything.