Shebang locations

The best way to write portable scripts is to use #!/usr/bin/env bash so you can be sure it will work if the person has the program in their PATH.

A limitation of that is when you need to pass parameters to the program in the shebang, because env won’t pass it. #!/usr/bin/env bash -foobar will discard -foobar. This isn’t an issue with bash, but some other runtime (perl for example) may benefit from useful flags :confused:

9 Likes