Bashify dist.sh

This uses a few features of the bash that weren't previous used:
* set -e so the checks for commands failing isn't needed
* don't do pointless pipe from cat->grep->awk when awk is able to do it in one go with proper redirection.

This should be tested on OS X, but should work. It seems to work fine with bash & zsh (the changes also work with dash, but other parts of the script are incompatible, specifically line 5.)