env won't accept arguments in shebang

"Todd A. Jacobs" <[email protected]>
Newsgroups gmane.comp.gnu.sh-utils.bugs
Message-ID <[email protected]>
Environment: env 2.0.11 on an x86-based Red Hat Linux 7.x machine.

I'm not 100% sure this is a bug, but I can't find an explanation for this
behavior in either the env texinfo file or on the sh-utils FAQ page.  If
you run this command from the shell prompt:

	echo 'print "foo\n"' | /usr/bin/env perl -w

env works as expected. However, the corresponding perl script:

	#!/usr/bin/env perl -w
	print "foo\n"

returns the following error:

	/usr/bin/env: invalid option --  
	Try `/usr/bin/env --help' for more information.

This is true for pretty much any command which is passed an argument. It
works fine from the prompt, but simply won't work on a shebang line. Is
this expected behavior? If so, why?

-- 
"The only thing that helps me maintain my slender grip on reality is the
friendship I share with my collection of singing potatoes."

			- Holly, JMC Vessel *Red Dwarf*
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.