#!/usr/bin/python or #!/usr/bin/env python?
Erik Max Francis
max at alcyone.com
Wed Aug 9 15:29:27 EDT 2006
ZeD wrote:
> but...
>
> $ cat test.py
> #!/usr/bin/env python
>
> print "Hello, world"
> $ file test.py
> file.py: a python script text executable
>
> following what you said, test.py is a /usr/bin/env script, not a python one.
That's rather a silly interpretation of what I said, I think. After all::
% cat > test.gargle
#!/usr/bin/env gargle
asdfasflsafhklsfhklsdfhsdf
max at oxygen:~/tmp% file test.gargle
test.gargle: a gargle script text executable
`file` knows how /usr/bin/env is used because it's not only a standard
Unix idiom, it's the primary purpose for which it exists. That's not
the case with endless variants of /bin/sh scripts whose first statements
involve running another interpreter in some clever way that's not
detected by _that_ interpreter's processing, which is what the
previously discussed tricks amount to.
--
Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis
Punctuality is the virtue of the bored.
-- Evelyn Waugh
More information about the Python-list
mailing list