I am relatively new to bash.
I had bash 3 In my mac by default.
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin18)
Copyright (C) 2007 Free Softw
If you have two versions of bash installed, you need to make sure you are running the right one. In a script you need a first line like:
#!/usr/local/bin/bash
(Adjust path as necessary for your installation.)
If you are interactive, make sure you are actually running the version of bash you expect, not just that it's the first 'bash' in your search path.