Path: utzoo!attcan!uunet!cs.utexas.edu!ut-emx!walt.cc.utexas.edu!erlkonig From: erlkonig@walt.cc.utexas.edu (Christopher North-Keys) Newsgroups: comp.unix.wizards Subject: Re: skeleton sys.login and sys.cshrc Keywords: csh scripts Message-ID: <21282@ut-emx.UUCP> Date: 22 Nov 89 02:33:21 GMT References: <46bbe06a.bfe8@tachyon.engin.umich.edu> Sender: news@ut-emx.UUCP Reply-To: erlkonig@walt.cc.utexas.edu (Christopher North-Keys) Distribution: na Organization: Packaging/Interconnect, M.C.C. Lines: 44 (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)----------------------------------