3 ms·
so this isn't related to the article so much, but to something the article reminded me about: why do people use /usr/bin/env to find a program rather than setti
by naikrovek 5y ago
so this isn't related to the article so much, but to something the article reminded me about: why do people use /usr/bin/env to find a program rather than setting the PATH within the script to a known-good value then using that to locate things?
the path that /usr/bin/env returns is (essentially) a global variable that can change underneath you, right? I mean that just screams "variable that may be changed by others" to me.
I've never understood why /usr/bin/env exists.
- dredmorbius 5y agoPortability. The /usr/bin/env trick will work on a wide range of systems, in which even common utilities might have numerous locations: /bin, /sbin, /usr/bin, /usr/bin/local, /opt, or others. If you're writing scripts for portability and ohers, this has value. That said, /usr/bin/env fails on Android/Termux AFAIU.