Date: Mon, 4 Jun 2001 05:41:24 +0100 (BST) From: Mark Valentine <mark@thuvia.demon.co.uk> To: "Andrew Reilly" <areilly@bigpond.net.au> Cc: Peter Seebach <seebs@plethora.net>, hackers@freebsd.org Subject: Re: Fixing documented bug in env(1) Message-ID: <200106040441.f544fOF58859@dotar-sojat.thuvia.org> In-Reply-To: "Andrew Reilly"'s message of Jun 4, 1:51pm
index | next in thread | raw e-mail
> From: "Andrew Reilly" <areilly@bigpond.net.au>
> Date: Mon 4 Jun, 2001
> Subject: Re: Fixing documented bug in env(1)
> > 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?
>
> env - PATH=$PATH dhclient ed0
Using env(1) without any assumtion about command line assignment parsing
purely as an illustration:
$ env - sh -c "PATH=$PATH dhclient ed0"
I'd probably wrap thus up in a script (or external program for ease of
use by various shells) - the semantics are subtly different from env(1):
$ clearenv() { env - sh -c "$*"; } # cheap and nasty to illustrate
$ clearenv PATH=$PATH dhclient ed0
Making clearenv(1) an external program (which doesn't itself parse command
line variable assignments) may simplify quoting, and if ``dhclient'' were
instead a shell builtin such as echo(1), you'd need to avoid the shortcut
above, as in:
$ clearenv "PATH=$PATH; export PATH; dhclient ed0"
Cheers,
Mark.
--
Mark Valentine, Thuvia Labs <mark@thuvia.co.uk> <http://www.thuvia.co.uk>
"Tigers will do ANYTHING for a tuna fish sandwich." Mark Valentine uses
"We're kind of stupid that way." *munch* *munch* and endorses FreeBSD
-- <http://www.calvinandhobbes.com> <http://www.freebsd.org>
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200106040441.f544fOF58859>
