How to use bash version 4 or 5 on XCode 10.2 image

Our builds are using the macos: xcode: 10.2.1 image. The /bin/bash --version there is 3.2.57. Is there a way to upgrade the shell to bash 5 so I can use Bash’s built-in uppercase string conversion of

echo "${a^^}"

in my script? I have the same bash commands running fine on my Android side which is image circleci/android:api-28-node using Bash 5.0.3.
But on the iOS side, with xcode 10.2.1 image I get a “bad substitution” error.

Hi Terri,

I had a go at this today, and I got some good results:

https://circleci.com/gh/marcomorain/python/453

This is the config that does the necessary:

version: 2.1
jobs:
  build:
    macos:
      xcode: 11.0.0

    # Use Bash installed from Homebrew as the default shell
    # https://circleci.com/docs/2.0/configuration-reference/#default-shell-options
    shell: /usr/local/bin/bash --login -eo pipefail

    steps:
      - checkout

      - run:
          name: Install bash 5 using the system bash
          shell: /bin/bash -eo pipefail # Use the system bash for this step.
          command: brew install bash
          environment:
            HOMEBREW_NO_AUTO_UPDATE: 1 # This is faster

      # Now all steps use the new bash:
      - run: bash -version # Show bash version
      - run: echo $0       # Show current shell

And there is information about shell options here: https://circleci.com/docs/2.0/configuration-reference/#default-shell-options