What's the difference?

Jürgen A. Erhard juergen.erhard at gmx.net
Mon Jan 15 12:02:24 EST 2001


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

>>>>> "David" == David Porter <jcm at bigskytel.com> writes:

    David> * Simon Foster <simon at uggs.demon.co.uk>:
    >> Whats the difference between :
    >> 
    >> #! /usr/bin/env python
    >> 
    >> and :
    >> 
    >> #! /usr/bin/python

    David> the first is using the env program to divine the location
    David> of python using the users environment. The second is a
    David> direct path to python. The first is the safest bet if you
    David> do not know where python will be. For example, many people
    David> put python in /usr/local/bin. The first would still work,
    David> but the second would need to be changed.

Correct.

But it should be noted that the second form should be used for scripts
that have to keep an eye on security...  /usr/bin/env uses the user's
PATH, so it could be possible to get the user to execute a different
script than the one intended.

And absolute path avoids this.

Bye, J

- -- 
Jürgen A. Erhard    juergen.erhard at gmx.net   phone: (GERMANY) 0721 27326
          My WebHome: http://members.tripod.com/Juergen_Erhard
                    Bill Gates brought you Windows.
                Linus brought you the whole DAMN HOUSE!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (GNU/Linux)
Comment: Use Mailcrypt and GnuPG <http://www.gnupg.org/>

iEYEARECAAYFAjpjLSAACgkQN0B+CS56qs3MygCdG49Kn4e1uVhWsC1sCD/cGmBf
998AnRiFdW5OjAJPdXusOAzJqj+w1ILa
=m6YQ
-----END PGP SIGNATURE-----




More information about the Python-list mailing list