#!/usr/bin/python or #!/usr/bin/env python?
Michał Bartoszkiewicz
embe-ml at magma-net.pl
Wed Aug 9 02:33:19 EDT 2006
On 2006-08-09 at 08:02:03 (+0200), Stephan Kuhagen wrote:
> Don't yell at me for bringing in another language, but I really like the
> trick, Tcl does:
>
> > #!/bin/sh
> > # The next line starts Tcl \
> > exec tclsh "$0" "$@"
>
> This works by the somewhat weird feature of Tcl, that allows comments to be
> continued in the next line with "\" at the end of the comment-line. It
> looks unfamiliar, but has several advantages, I think. First it's really
> VERY unlikely, that there is no /bin/sh (while I found systems with
> different places for env), and you can add some other features at or before
> the actual call of the interpreter, i.e. finding the right or preferred
> version... - This way I coded a complete software-installer, that runs
> either as a Tcl/Tk-Script with GUI, or as bash-script, when no Tcl is
> available. - I really would like to have something like that for python,
> but I did not find a way to achieve that, yet.
You could use:
#!/bin/sh
"""exec" python "$0" "$@"""
:)
--
__ ____________________________________________________________________
| \/ | Michał Bartoszkiewicz <embe at magma-net.pl> | _ )
| |\/| | GG:2298240 | _ \
|_| |_|_For all resources, whatever it is, you need more. [RFC1925]_|___/
More information about the Python-list
mailing list