I have often used bash to write shell script. In most cases, you have to hurry up and you don't go further into ... Here is two tips that could help you.
Developp without worrying
#!/bin/bash set -euo pipefail IFS=$'\n\t'
With theses paramters, you will be able to detect silent errors, un intialize variables and so on...
See that good link for more details : http://redsymbol.net/articles/
Help in syntax
Here is a cool link to help you in shell syntax : http://www.shellcheck.net/