Thank you for opening this bug and helping make Ubuntu better.
I am unsure if this is a coreutils limitation (meaning I am pretty sure it is *not*, but not absolutely so). Although 'env' does allow for parameters to the called program, 'bash', for example, limits this usage:
(from 'info bash', chapter 3.8 "Shell Scripts"):
"if `filename' is an executable shell script. This subshell
reinitializes itself, so that the effect is as if a new shell had been
invoked to interpret the script, with the exception that the locations
of commands remembered by the parent (see the description of `hash' in
*note Bourne Shell Builtins::) are retained by the child.
Most versions of Unix make this a part of the operating system's
command execution mechanism. If the first line of a script begins with
the two characters `#!', *the* *remainder* *of* *the* *line* specifies an
interpreter for the program. Thus, you can specify Bash, `awk', Perl,
or some other interpreter and write the rest of the script file in that
language."
(my bolding, above.)
I do not remember this usage ever working on Linux... but it sounds to me that this would be, then, a limitation imposed by (in my example) bash, not a case of coreutils' 'env' misbehaving.
Although I cannot find a real clear explanation for 'dash', the behaviour is the same (it considers 'dash -x' -- in my tests I had "#!/build/buildd/env dash -x" as the shebang -- as a single "name".
As far as I can remember, but I may be wrong, this was enforced to limit some exploits.
Thank you for opening this bug and helping make Ubuntu better.
I am unsure if this is a coreutils limitation (meaning I am pretty sure it is *not*, but not absolutely so). Although 'env' does allow for parameters to the called program, 'bash', for example, limits this usage:
(from 'info bash', chapter 3.8 "Shell Scripts"):
"if `filename' is an executable shell script. This subshell
reinitializes itself, so that the effect is as if a new shell had been
invoked to interpret the script, with the exception that the locations
of commands remembered by the parent (see the description of `hash' in
*note Bourne Shell Builtins::) are retained by the child.
Most versions of Unix make this a part of the operating system's
command execution mechanism. If the first line of a script begins with
the two characters `#!', *the* *remainder* *of* *the* *line* specifies an
interpreter for the program. Thus, you can specify Bash, `awk', Perl,
or some other interpreter and write the rest of the script file in that
language."
(my bolding, above.)
I do not remember this usage ever working on Linux... but it sounds to me that this would be, then, a limitation imposed by (in my example) bash, not a case of coreutils' 'env' misbehaving.
Although I cannot find a real clear explanation for 'dash', the behaviour is the same (it considers 'dash -x' -- in my tests I had "#!/build/ buildd/ env dash -x" as the shebang -- as a single "name".
As far as I can remember, but I may be wrong, this was enforced to limit some exploits.