Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

what does the env in "env name=value command" buy me?

0 views
Skip to first unread message

Dan Jacobson

unread,
Jan 16, 2003, 6:52:13 PM1/16/03
to
dear sirs, is
$ env PAGER=cat LC_CTYPE=en_US.ISO8859-1 perldoc perltw
the same as
$ PAGER=cat LC_CTYPE=en_US.ISO8859-1 perldoc perltw
--
http://jidanni.org/ Taiwan(04)25854780

John L

unread,
Jan 17, 2003, 12:18:40 AM1/17/03
to

"Dan Jacobson" <jid...@dman.ddts.net> wrote in message news:87iswoz...@jidanni.org...

> dear sirs, is
> $ env PAGER=cat LC_CTYPE=en_US.ISO8859-1 perldoc perltw
> the same as
> $ PAGER=cat LC_CTYPE=en_US.ISO8859-1 perldoc perltw

Yes. What the env command buys you is the ability to remove either the whole
environment or just selected parts of it. This can be very useful in testing, and in
making sure that your lovingly-developed new program does not have a hidden
dependency on something you added to your .profile three years ago.
Look at env -i or -u. Note that env -u VARIABLE command is *different* from
VARIABLE= command -- in the latter case VARIABLE is still in command's
environment even though it has been set to nothing.

John.


Barry Margolin

unread,
Jan 17, 2003, 12:11:07 PM1/17/03
to
In article <b083i6$86c$1...@news5.svr.pol.co.uk>,

Another thing that the env command buys is shell-independence. In
csh/tcsh, to run a command with temporary environment changes, you would
need to do:

(setenv PAGER cat; setenv LC_TYPE=en_US.ISO8859-1; perldoc perltw)

The env command works the same no matter what shell you're using it from.

--
Barry Margolin, bar...@genuity.net
Genuity, Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.

0 new messages