#!/usr/bin/python or #!/usr/bin/env python?
Tobias Brox
tobias at stud.cs.uit.no
Wed Aug 9 05:26:50 EDT 2006
[Erik Max Francis]
> 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.
I have no clue about Tcl, but it was said some postings ago that "all
Tcl-scripts are recognized as sh". If this is true, I think it ought
to be fixed. Searching for one of the very first lines to begin with
#, end with \, and followed by "exec tcl" doesn't sound like
rocket-science to me, though I've neither studied magic(4) or Tcl
scripting conventions.
I do understand that it would still be many ways to start a Tcl-script
without getting recognized by the above logic, as well as ways to
trick file into reporting a real shell script to be a Tcl-script.
IMHO a 90% hit rate is far better than 0% hit rate.
> 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.
A shell script containing some inline tcl is a shell script, though
when the only shell-command is "start up tcl" and the rest of the file
is tcl-code, I really don't think it can be defined as a "shell
script" anymore. Particularly not if almost all tcl-scripts are
started that way.
--
Tobias Brox, 69°42'N, 18°57'E
More information about the Python-list
mailing list