How to upgrade bash to v4.0+ properly?
I reccomend getting Homebrew. Then run brew install bash, it will install bash 4.3.33. It's the easiest and safest way.

Then add the path to the executable to /etc/shells. For example: 

/usr/local/bin/bash