build.sh: fix bash-isms

Fixes usage of non-POSIX shell features in `build.sh`.