Just a bit of forewarning with regard to the "recommended" use of shebangs.
# Right:
#!/usr/bin/env bash
# Less right:
#!/bin/bash
Using env by default is not a good habit because as you state above:
The former searches the user's PATH to find the bash binary.
You do not WANT bash looking at a users local path for say, system scripts, things meant to be run by root or any other user. To say the latter is bad, is.. well, bad itself.
PATH can be manipulated, a script can be set readonly.
Took an inordinate amount of time to explain this to a junior sysadmin who was adamant every script on a production host should be changed "because".
Just a bit of forewarning with regard to the "recommended" use of shebangs.
Using env by default is not a good habit because as you state above:
The former searches the user's PATH to find the bash binary.
You do not WANT bash looking at a users local path for say, system scripts, things meant to be run by root or any other user. To say the latter is bad, is.. well, bad itself.
PATH can be manipulated, a script can be set readonly.
Took an inordinate amount of time to explain this to a junior sysadmin who was adamant every script on a production host should be changed "because".