script portability trick

Roy Dragseth royd at cc.uit.no
Thu Jan 17 15:27:53 EST 2002


Russ wrote:

> A traditional unix trick in Tcl/Tk is to start scripts like this:
> 
> #!/bin/sh
> # the next line starts wish \
> exec wish "$0" "$@"
> 
> This causes the Bourne shell to search the user's executable path to
> find wish each time the script is executed. Because the script doesn't
> depend on wish being in a particular directory, it is more portable
> (sh is almost always in /bin, but wish can be anywhere).
> 
> Is there a similar trick for Python? Thanks.

I usually start my python scripts with 

#!/usr/bin/env python

I haven't seen an environment where env wasn't in /usr/bin yet.

Anyone?

r.




More information about the Python-list mailing list