3 ms·
/bin/env was always a bad idea. Way before Linux was even a thing, every Unix used /usr/bin/env - and that was the point of it being used to find an interpreter
by nailer 11y ago
/bin/env was always a bad idea. Way before Linux was even a thing, every Unix used /usr/bin/env - and that was the point of it being used to find an interpreter. Red Hat (where I worked at the time, man years ago) realised the mistake, but alas didn't want to break compatibility.
'lsb-release' was always hilarious: the one thing about Linux that is almost standard is that the LSB tools are never present.
- JupiterMoon 11y agoWhy is this a bad idea?
- rleigh 11y agoBecause the whole point is portability, so hardcoding /bin/env when the rest of the world is using /usr/bin/env makes it nonportable!
- JupiterMoon 11y agoI'm still confused should I use: #!/usr/bin/env python #!/usr/bin/python And why?
- mkingston 11y agoIIRC not all distros will put executable binaries in /usr/bin/, but even those that don't will usually provide /usr/bin/env (even as a symlink), which will then search your path for python. In summary: /usr/bin/env is more portable. I'm unsure whether "#!/usr/bin/env python" is equivalent to #!python.
- takeda 11y agoYou should use: #!/usr/bin/env python or preferably #!/usr/bin/env python2 or #!/usr/bin/env python3 env supposed to always be in /usr/bin, while python doesn't. On FreeBSD for example it is in /usr/local/bin because it is not integral part of the OS.