Softlink /bin/bash to a brew-installed bash

bashcommand linehomebrewsymlinkterminal

It is a question related to this other one, but I can't comment.

I've updated to use bash 4 from brew installation. But I don't know if changing all the header scripts from:

#!/bin/bash

To

#!/usr/local/bin/bash

Isn't a portable solution.

Moreover, some scripts check if the shell is a /bin/bash shell (docker-toolbox in example)

Before writing, I was recommended to read this: https://apple.stackexchange.com/a/119179/77314
But the path solution is neither portable nor can apply on docker case (no direct source).

So I still doubt: is really a bad idea to softlink the bash?

Obviously, targeting independent-version.

Best Answer

#!/usr/bin/env bash is the 'most portable' approach but #!/bin/bash is the standard convention on OS X and Linux. There are advantages to shebang with a stable system interpreter, and it's probably not worth using a newer Bash.