Add shellcheck utility and perform script cleanup

I found a great utility in Haskell that is a lint-style tool for shell
scripts. It supports `sh`, `bash`, `ksh` and `zsh`. I quickly used it on
all my shell scripts to ensure they are as idiomatic as possible.