How to upgrade bash with brew (permission error)?

You must be sure that the group of /usr/local and all inside it is admin (I'm supposing your username belongs to admin group too). If this isn't the case, fix it with:

sudo chown -R $USER:admin /usr/local

You will probably have to do the same on /Library/Caches/Homebrew:

sudo chown -R $USER:admin /Library/Caches/Homebrew