4bsd .login and .cshrc

Jerry Aguirre jerry at oliveb.olivetti.com
Thu Apr 7 10:04:08 AEST 1988


In article <453 at q7.tessi.UUCP> joey at tessi.UUCP (Joe Pruett) writes:
>As has been mentioned, rsh does not source your .login file.  This is
>quite obnoxious when you set your path in your .login (where it belongs
>so that each shell isn't hashing your path more than necessary).

I disagree.  My path is set in my .cshrc.  The setting is conditional on
and environment variable so that sub shells don't reset it.  It looks
like:
    if (! $?MAIL) then
	    setenv MAIL /usr/spool/mail/jerry
	    set path=(. ~jerry/bin /usr/ucb /bin /usr/bin)
    endif

This is a lot simpler than inventing new files to be sourced.  I bet it
is faster too.  (I don't remember what program wanted a "MAIL" variable,
any environment variable not set at login time would do.)

People should also be aware that setting the prompt in their .cshrc
should also be conditional.  They should use something like:
    if ($?prompt) then
	    set histchars=\\^
	    set prompt="\> " history=60 mail=(120 /usr/spool/mail/$USER)
	    alias 1 %1
	    ...
    endif

Anything dealing with prompts, history, or any other "interactive"
variable should be executed only for interactive logins.  My opinion is
that almost all aliases should also be conditional.  An alias is used
primarily to save typing and that doesn't apply to non-interactive
usage.



More information about the Comp.unix.questions mailing list