The only real debugging-tool the shell provides is the 'set -x' command. After this command is executed, all further commands will be printed to the terminal before they are executed until a 'set +x' command is found.

A BASH debugger has also been developed. This may make life easier for you. Check out