Hi I'm trying to update bash in my shell scripts to v5 on macos. Example shell scripts:
#!/usr/bin/env bash which bash echo $BASH_VERSION
Updating bash in my terminal is successfull however in any of my existing shell scripts, it keeps on falling back to v3.2.57(1)-release (/bin/bash) wile i want to use v5.x (which is in /usr/local/bin/bash). Whenever I change the PATH variable so that /bin/ is not included (only /bin/env) I get a different error:
env: bash: No such file or directory
Whenever I do include it, v3.2 is used in the script..
Things I did:
- Removed /bin/bash from /etc/shells
- Tried change PATH variable so that #!/usr/bin/env bash still works but v3.2 is not used
- Add /usr/local/bin to path which results in
./my-script: line 215: sh: command not found
Anyone has any more tips I can try?
My Path configuration:
#start path from fresh export PATH=/usr/local/bin export PATH=$PATH:/bin export PATH=$PATH:/usr/bin/ echo $PATH #output = /usr/local/bin:/bin:/usr/bin/