ShellCheck is a useful tool for analyzing code and potentially catching errors before they happen. It can be found here.