unbound variable – bash completion not working and having issues with other stuff like command not found.

I generally use vi/vim for all my practical purposes of working with text files. And I have all the vi/vim plugins required to work with the files. This causes the following to be in the skeleton for all the bash scripts that I create:

set -o nounset                              # Treat unset variables as an error

With this all the unbound variables as errors and was problem with all the shell scripts that was being sourced in the startup of bash. So all I had to do was remove this from all the startup scripts and then from the skeleton of the bash script in vim :).

The solution is quite easy but finding this was really a tough task.