(14-09-2016, 08:59 PM)pranomostro Wrote: > Not the right interpreter is found
Some path are standardized by POSIX, like /bin/sh. env(1) location is not defined by POSIX. All it does is that it will run the 'utility' using the current environment, which is supposed to has the $PATH variable set correctly. One could technically just implement the shebang to search 'utility' in the PATH, which would allow things as "#!sh".
(14-09-2016, 08:59 PM)pranomostro Wrote: > No dependencies or modules
I'm not especially smarter than you are, but as far as I understand this point, it present corner cases where the same 'utility' appear multiple times in the PATH, at multiple locations. That's the same as you 3rd point.
(14-09-2016, 08:59 PM)pranomostro Wrote: > no flags
This is, again, implementation specific. And while it MIGHT be the case, it has never been actually experienced (see http://www.in-ulm.de/~mascheck/various/shebang/). What's true though, is that the shebang line is limited, and this limitation is (again!) implementation specific. I've personally been using "#!/bin/sed -f" or "#!/bin/sh -ex" happily for quite some times now.
(14-09-2016, 08:59 PM)pranomostro Wrote: > wrong configuration of $PATH
The exact problem mentionned is "The fifth and worst problem is that your script is at the mercy of the user’s environment configuration.".
THAT IS THE FUCKING POINT OF THE env(1) UTILITY! Of course it will use the environment of the user BECAUSE THAT'S FUCKING WHAT YOU'RE ASKING FOR. "#!/usr/bin/env bash" means "run 'bash' within the current environment. So it's freaking stupid to discuss this point as it would be like complaining about planes not touching the ground all the time.
Regarding this whole topic, the shebang is a nifty feature provided by some kernels to hack around the fact that some executables are NOT executable by a machine. You shouldn't expect much about it, but you can have enough confidence in it to use it (It's kind of like relying on bash(1) to be installed everywhere in the end).
By nature, the shebang is not portable, for the simple reason that it's not standardized:
http://pubs.opengroup.org/onlinepubs/969...hap02.html Wrote:If the first line of a file of shell commands starts with the characters "#!", the results are unspecified.
Heh, I like using something like
My use of python is generally very limited, though. You can always specify version this way, as you're literally passing a heredoc to the python interpreter; you can call whichever interpreter in your path you require, or /usr/bin/python3.4 if you so desire.
edit - formatting is messed up, heh.