From owner-freebsd-hackers Sun Jun 3 21:41:36 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from phaidor.thuvia.org (thuvia.demon.co.uk [193.237.34.248]) by hub.freebsd.org (Postfix) with ESMTP id 4952737B401 for ; Sun, 3 Jun 2001 21:41:32 -0700 (PDT) (envelope-from mark@thuvia.demon.co.uk) Received: from dotar-sojat.thuvia.org (dotar-sojat.thuvia.org [10.0.0.4]) by phaidor.thuvia.org (8.11.3/8.11.3) with ESMTP id f544fRm00449; Mon, 4 Jun 2001 05:41:27 +0100 (BST) (envelope-from mark@dotar-sojat.thuvia.org) Received: (from mark@localhost) by dotar-sojat.thuvia.org (8.11.3/8.11.3) id f544fOF58859; Mon, 4 Jun 2001 05:41:24 +0100 (BST) (envelope-from mark) Date: Mon, 4 Jun 2001 05:41:24 +0100 (BST) From: Mark Valentine Message-Id: <200106040441.f544fOF58859@dotar-sojat.thuvia.org> In-Reply-To: "Andrew Reilly"'s message of Jun 4, 1:51pm X-Mailer: Mail User's Shell (7.2.6 beta(5) 10/07/98) To: "Andrew Reilly" Subject: Re: Fixing documented bug in env(1) Cc: Peter Seebach , hackers@freebsd.org Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > From: "Andrew Reilly" > 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 "Tigers will do ANYTHING for a tuna fish sandwich." Mark Valentine uses "We're kind of stupid that way." *munch* *munch* and endorses FreeBSD -- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message