Fix bashisms in shell scripts

Bashisms in scripts may cause problems on systems where the default
shell is not Bash.

I could not test the changes on Darwin lacking the development environment.