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/bash
, #!/bin/sh
or whatever?
Asked
Active
Viewed 411 times
0

Kalle Richter
- 2,192
1 Answers
0
I think this became popular because of python.
With this you can do
#!/usr/bin/env python3
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.

mikst
- 111