On 12/2/05, Chris Devers <[EMAIL PROTECTED]> wrote:
> My understanding is that the Python idiom is to avoid putting the full
> path, in favor of something like
>
>     #!/usr/bin/env python
>     #!env python
>
> on grounds that Python may not be quite as common, but you could depend
> on the `env` command being available, so as long as `python` was in the
> $PATH somewhere, invoking it this way should work. That makes sense, but
> now that I think about it I'm not clear why they don't just use
>
>     #!python
>
> which seems like it should amount to the same thing.

Just for the record, I found with the help of the people at
python-list@python.org that the difference about "#!/usr/bin/env
python", "#!env python" and "#!python" is that not every shell looks
up the shebang executable in the path, and the last two forms ("#!env
python" and "#!python" ) will be generally met with an error like

     bash: hello.pl: perl: bad interpreter: No such file or directory

even though

     $ perl hello.pl

may work at the shell prompt. This ("!/usr/bin/env perl") may be a
useful device if you trust the interpreter you want will be the first
found in the path. Perl scripts installed by the common MakeMaker
mantra won't have such issues as the shebang line is automatically
updated (and that prevents mixing code installed with one version to
run with another).

Adriano.

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to