Variations on a theme by "pound bang"

jam jam at
Sun Jun 13 14:14:14 EDT 1999

On Sun, Jun 13, 1999 at 05:17:33PM +0000, Sean Mc Grath wrote:
> Can anyone shed some light on the benefits of:-
> # !/usr/bin/env python
> as opposed to
> # !/usr/bin/python
> Sean


the first one is more generic, and independent of the actual location of the
command in question (in this case, the python interpreter). there's a man
page for 'env'-- it basically reads the PATH variable, and looks for it's
argument on it. a danger is that it might leave your scripts open to attack
(if someone manages to place a trojan program somewhere in the path *before*
the actual 'python' interpreter, say in $HOME/bin).

the 2nd one is specific to finding the python interpreter in '/usr/bin',
which might be fine for you, but I might install mine in /usr/local/bin
instead, for example. it's a bit more secure in that someone will have to
compromise /usr/bin, which is (theoretically) more difficult.

hope that helps.

|| visit gfd <> 
|| psa member #293 <> 
|| New Image Systems & Services, Inc. <>

More information about the Python-list mailing list