[aklug] Re: purpose of env

From: barsalou <barjunk@attglobal.net>
Date: Sat Sep 11 2010 - 15:46:54 AKDT

Quoting bryanm@acsalaska.net:

> After Christopher mentioned env, I checked the manpage for it.
> I don't quite get it. What's the difference between:
> VAR=3Dvalue progname
>
> and:
> env VAR=3Dvalue progname
>
> ? Is it only useful for the -i and -u options?

Brian,

I didn't see a response to this and from what I can tell, this allows =20
you to set the environment for only the command that you will be =20
issuing.

so:

env SOMEVAR=3Dtemporary myprog arg1 arg2

would launch myprog with SOMEVAR set to "temporary" for only that =20
invocation, however:

SOMEVAR=3Dpermanent

Would set SOMEVAR to "permanent" for each command that was issued in =20
the shell.

This may vary based on what shell your using. In my example, I'm using bash=
.

I also believe (but have not tested) that issuing the command:

SOMEVAR=3Dtemporary myprog arg1 arg2

would produce the same result as the env command above in the bash =20
environment.

It is entirely possible that using env would work across different =20
shell environments. env is a coreutils command from what I can tell =20
and should be available to anyone that compiles that set of utilities.

Mike B.

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.

---------
To unsubscribe, send email to <aklug-request@aklug.org>
with 'unsubscribe' in the message body.
Received on Sat Sep 11 15:47:02 2010

This archive was generated by hypermail 2.1.8 : Sat Sep 11 2010 - 15:47:02 AKDT