improve portability of bash scripts to Mac OS X