bash 4.4 on macOS

# Get the sources

mkdir -p ~/opt/src
cd ~/opt/src
curl -O http://ftp.gnu.org/gnu/bash/bash-4.4.tar.gz
tar zxf bash-4.4.tar.gz

# prepare place for installation
mkdir -p ~/opt/usr

# build the stuff
cd ~/opt/src/bash-4.4
./configure --prefix=$HOME/opt/usr
make
make install

# test the thing
$HOME/opt/usr/bin/bash --version

use it

#!/Users/your_user_name/opt/usr/bin/bash

echo $BASH_VERSION