skeleton sys.login and sys.cshrc

Christopher North-Keys erlkonig at walt.cc.utexas.edu
Wed Nov 22 13:33:21 AEST 1989


(part of the genesis of the scripts collectively called the "elfshell")

The problem we had goes as follows:
	csh user logs in.
	.cshrc runs (cannot use env settings in .login)
	.login runs (should contain the env settings)
	user calls subshell
	.cshrc runs (*CAN* use env settings from .login)

The user wanted to put all the setenv things in the .login, and all the 
aliases and suchlike in the .cshrc.  The problem is that all .cshrc's *save*
the first had the user's full environ, and could depend on them in subsequent
aliases like:  alias p $PAGER .  The first run of the .cshrc alone had to
be independent of the environment.

The idea we had was that every shells .cshrc should be as small as possible,
and thus putting everything possible into the .login and running all the env
stuff first JUST ONCE would be a nice speed improvement.

This, of course, doesn't work, as the .login runs second---perfect for
checking mail and suchlike, but at best a jury-rigged substitute for what
we wanted.

We added a new file, .cshlc (C-sh login commands), in which we placed all
the setenv commands and suchlike along with the command:

	setenv LOGGED $USER

we then altered the .cshrc to source this file if $LOGGED didn't equal $USER:
(near very beginning of .cshrc)

	if!($?LOGGED) setenv LOGGED
	if ("$LOGGED" != "$user") source ~/.cshlc

(it looks strange, but it's as few lines as we could manage)
and finished the job by reducing the .login to the level of commands like
from, quota, and logging.

This made everything run quite nicely.

------------------------------------/\----------------------------------------
Seo:  Harp[@Mcc.Com]               /  \/\ ^*^           Christopher North-Keys
Tha mi gu trang a'cluich.         /    \ \         Assoc. Systems Analyst, MCC
--------------------------------(disclaimer)----------------------------------



More information about the Comp.unix.wizards mailing list