http://www.shellcheck.net/ is a linter for Bash that covers a lot of this (and more, too). repo at https://github.com/koalaman/shellcheck