script portability trick

Aahz Maruch aahz at panix.com
Thu Jan 17 15:24:07 EST 2002


In article <bebbba07.0201171203.4ce00461 at posting.google.com>,
Russ <18k11tm001 at sneakemail.com> 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.

The standard gimmick for Python is:

#!/usr/bin/env python
-- 
                      --- Aahz  <*>  (Copyright 2002 by aahz at pobox.com)

Hugs and backrubs -- I break Rule 6                 http://www.rahul.net/aahz/
Androgynous poly kinky vanilla queer het Pythonista   

"There are times when effort is important and necessary, but this should
not be taken as any kind of moral imperative."  --jdecker



More information about the Python-list mailing list