Fix some errors running on OSX 10.9 with Homebrew toolchain

First off, thank you for pulling together a coherent and useful toolchain for command OCR. I've spent too much time looking for this.


These changes probably depend more on the version of bash/sh being used.