#!/usr/bin/python or #!/usr/bin/env python?

Erik Max Francis max at alcyone.com
Wed Aug 9 04:52:20 EDT 2006


Tobias Brox wrote:

> This is very off-topic, but if it's fairly common to begin tcl-scripts
> as a /bin/sh-file with "exec tcl" at one of the first lines, I think
> "file" ought to be able to recognize it. 
> 
> """exec" python is clearly an obscure hack not used by many, so I
> don't see why "file" should ever recognize that :-)

The point is, they're all part of the same tactic -- the particulars of 
sh.  Special casing each one is a task without an end.  People will come 
up with variants that will do the right thing but foil `file`, 
intentionally or unintentionally -- just as we've seen in this thread.

The right way to approach this with `file` is to acknowledge that such 
tricks are inherently sh-specific and leave it identified as a sh file. 
  Because that is, of course, exactly what it is.

-- 
Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
  San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis
   Only those who dare to fail greatly can ever achieve greatly.
    -- Robert F. Kennedy



More information about the Python-list mailing list