script portability trick

Cameron Laird claird at starbase.neosoft.com
Thu Jan 17 16:00:58 EST 2002


In article <a27bt7$22l$1 at panix3.panix.com>, Aahz Maruch <aahz at panix.com> wrote:
>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
			.
			.
			.
Neither of these are particularly "about" wish or Python;
they're just ancient Unix traditions that Tclers and
Pythoneers happen to have differentially adopted.  The same
"tricks" or "gimmicks" work for either equally well, though.

Incidentally, the first one is suboptimal, as <URL:
http://mini.net/tcl/812.html > documents.
-- 

Cameron Laird <Cameron at Lairds.com>
Business:  http://www.Phaseit.net
Personal:  http://starbase.neosoft.com/~claird/home.html



More information about the Python-list mailing list