[comp.unix.questions] Diff between set and setenv

leein@uicsrd.csrd.uiuc.edu (04/21/89)

Hi,

I have questions that some gurus might help with.

In a csh under BSD

1.  There are things that are to be 'set' and things to be 'setenv'.
    What is the difference conventionally or logically?

2. What variables should go to .login only, and what variables should 
   go to .cshrc only?

3. What set and what setenv variables
   can be transferred from the login shell to the newly created shells?

4  Where in the UNIX manual can I find those things in a well organized
   form?

Thanks.

                In

maart@cs.vu.nl (Maarten Litmaath) (04/25/89)

leein@uicsrd.csrd.uiuc.edu writes:
\In a csh under BSD

\1.  There are things that are to be 'set' and things to be 'setenv'.
\    What is the difference conventionally or logically?

setenv'ed variables will be exported to all programs you execute from your
shell: they are put into the ENVIRONMENT (get it? set-ENV)

\2. What variables should go to .login only, and what variables should 
\   go to .cshrc only?

.login: variables you only want to set ONCE (typically environment variables)
	- setenv PATH $HOME/bin:/bin:/usr/bin:/usr/ucb:/usr/local/bin
.cshrc: variables you want to set in EACH invocation
	- set history = 50

\3. What set and what setenv variables
\   can be transferred from the login shell to the newly created shells?

All setenv'ed variables, no set variable.

\4  Where in the UNIX manual can I find those things in a well organized
\   form?

csh(1), execve(2)
-- 
 "If it isn't aesthetically pleasing, |Maarten Litmaath @ VU Amsterdam:
  it's probably wrong." (jim@bilpin). |maart@cs.vu.nl, mcvax!botter!maart

pme@io.UUCP (Paul English x3168) (04/25/89)

In article <2363@solo11.cs.vu.nl> maart@cs.vu.nl (Maarten Litmaath) writes:
>leein@uicsrd.csrd.uiuc.edu writes:
>\2. What variables should go to .login only, and what variables should 
>\   go to .cshrc only?
>
>.login: variables you only want to set ONCE (typically environment variables)
>	- setenv PATH $HOME/bin:/bin:/usr/bin:/usr/ucb:/usr/local/bin

Some users find it preferable to set the path explicitly in their
.cshrc so commands invoked remotely with rsh will use the correct
path.

Also, `su username' will begin a new shell as `username', reading only
the .cshrc (for csh). However, `su - username' will also read the
.login file.

Also (I know most people already know this), make sure any aliases you
want are set in your .cshrc instead of your .login. The way many
people setup their window system environments, the .login file is not
read at the start of the shell for each new window.
-- 
Paul English
  Interleaf: pme@ileaf.com, ...!{sun!sunne,mit-eddie}!ileaf!pme
  UMass/Boston: pme@umb.edu, ...!harvard!umb!pme
(umb has better email service)

barmar@think.COM (Barry Margolin) (04/26/89)

In article <2363@solo11.cs.vu.nl> maart@cs.vu.nl (Maarten Litmaath) writes:
>leein@uicsrd.csrd.uiuc.edu writes:
>\2. What variables should go to .login only, and what variables should 
>\   go to .cshrc only?
>
>.login: variables you only want to set ONCE (typically environment variables)
>	- setenv PATH $HOME/bin:/bin:/usr/bin:/usr/ucb:/usr/local/bin
>.cshrc: variables you want to set in EACH invocation
>	- set history = 50

Note that if you work in a networked environment it may be necessary
to put just about everything into .cshrc.  If you use rsh to execute
commands on other hosts, only the .cshrc will be run, and not the
.login.

Barry Margolin
Thinking Machines Corp.

barmar@think.com
{uunet,harvard}!think!barmar