Generally shells are quite hardly. If you specify a command, the shell will attempt to execute the script and make some good deduction based on some intrinsic rules of what it is and execute it as a script in most cases. That being said, in the case where there may be multiple shell implementations in your system, it can be tricky which should be used, most likely the first one in the
PATH environment variable
In your case, what you want to do is the following. Use the following shebang instead of hardcoding the path of the bash if that is the shell you would like the script to be interpreted
What the above does is populate the environment variables of the parent process that is executing the /usr/bin/env command into the child process and then execute the bash. This way, if there is a bash somehow in the
PATH environment, it will be picked up and executed as the interpreter to interpret this script.
I do this for a lot of my shell and perl scripts and other utilities too
Bash:
#!/usr/bin/env perl
#!/usr/bin/env bash
Read this.
https://www.cyberciti.biz/tips/finding-bash-perl-python-portably-using-env.html
Apparently
/usr/bin/env is quite consistently placed across most(if not all) unices.
If you are dealing with just Linux, we are not even really discussing about cross-platforms because when I refer to unices, it is cross platforms between BSD, Solaris, HP-UX, IBM AIX, Mac OS X, etc.
Someone whom is adequately experienced working in unices should knows about how executables are searched with PATH env var and should knows how to deal with a missing or faulty interpreter path.