Why use #!/usr/bin/env python rather than #!python?

Mike Meyer mwm at mired.org
Fri Dec 2 19:25:04 EST 2005


Carsten Haese <carsten at uniqsys.com> writes:
> (3) assumes that whatever shell the user is running looks up the shebang
> executable in the path, which bash, just to name one example, does not
> do.

For the record, on a modern Unix system, #! isn't handled by the
shell; it's handled by the kernel. #! is a "magic number" denoting a
type of executable. Some shells used to do that, and may still do that
if the underlying system doesn't handle it.

      <mike
-- 
Mike Meyer <mwm at mired.org>			http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.



More information about the Python-list mailing list