Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 4 Jun 2001 01:16:58 -0500
From:      Mike Meyer <mwm@mired.org>
To:        "Andrew Reilly" <areilly@bigpond.net.au>
Cc:        Mark Valentine <mark@thuvia.demon.co.uk>, Peter Seebach <seebs@plethora.net>, hackers@freebsd.org
Subject:   Re: Fixing documented bug in env(1)
Message-ID:  <15131.10202.189874.233196@guru.mired.org>
In-Reply-To: <20010604135106.A8896@gurney.reilly.home>
References:  <200106032352.f53Nqvn47341@dotar-sojat.thuvia.org> <20010604135106.A8896@gurney.reilly.home>

next in thread | previous in thread | raw e-mail | index | archive | help
Andrew Reilly <areilly@bigpond.net.au> types:
> On Mon, Jun 04, 2001 at 12:52:57AM +0100, Mark Valentine wrote:
> > By the way, who uses env(1) anyway?  In the past twenty years, I've only
> > ever used it as shorthand for printenv(1).  What's this csh(1) thing?  :-)
> How else do you throw away your environment, to make sure that
> daemons that you start with sudo don't do anything silly?

I think it's more commonly used in scripts, so you don't have to worry
about where the interpreter is installed. The python folks are
recommending the user of "#!/usr/bin/env python" instead of
"#!/usr/local/bin/python" for scripts, since the former works no
matter where python is installed. I understand that some of the perl
installation scripts use the same trick.

Even cooler - at least as far as I'm concerned - is that you can do
this if your interpreter is a script. That is, where
"#!/usr/local/bin/foobar" won't work because foobar is a Perl script,
"#!/usr/bin/env foobar" will work just fine.

This is documented on the env man page, though I don't think it's been
MFC'ed yet.

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

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?15131.10202.189874.233196>