newbie q: /usr/bin/env why?

Erik Max Francis max at alcyone.com
Sat Aug 26 18:12:20 EDT 2000


lynx wrote:

> okay, i've noted the tradition of python scripts invoking themselves
> with
> "#!/usr/bin/env python", but i can't figure out why. exactly what good
> thing does the env(1) invocation accomplish that python finds useful?

Using /usr/bin/env prevents you from hardcoding the Python interpreter's
path, which may be different on different systems (e.g.,
/usr/bin/python, /opt/python, /usr/local/bin/python, etc.). 
/usr/bin/env does all that work for you, as ensured to be in a standard
place.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/  \ Wars don't last forever, Henry.  Only war does.
\__/ Capt. Benjamin "Hawkeye" Pierce
    blackgirl international / http://www.blackgirl.org/
 The Internet resource for black women.



More information about the Python-list mailing list