Two minor fixes to improve bash scripts on OSX.

See commit messages for details.