Remove bashisms, fix shebangs

* Remove `function`: Allows ubuntu users to `sh build.sh`
* Ensure shebangs exist on first line of scripts