I already stumbled over
#!/usr/bin/env bash on numerous occasions and never questioned it. Now, I'm wondering what the purpose of wrapping the shell interpreter in an
env command, i.e. why not just write
#!/bin/sh or whatever?
I think this became popular because of python.
With this you can do
for example and be quite sure
env will find the right version and location for the executable.
Then this migrated to other shells because it seems like a good practice to always do even if you know where that particular shell is.