Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!bloom-beacon!sunkisd!uunet!mcvax!hp4nl!botter!star.cs.vu.nl!maart From: maart@cs.vu.nl (Maarten Litmaath) Newsgroups: comp.unix.questions Subject: Re^2: Identifying .login Shells Message-ID: <2044@solo9.cs.vu.nl> Date: 16 Feb 89 01:16:52 GMT References: <309@wubios.wustl.edu> <420@lakart.UUCP> Organization: V.U. Informatica, Amsterdam, the Netherlands Lines: 41 dg@lakart.UUCP (David Goodenough) writes: \From article <309@wubios.wustl.edu>, by david@wubios.wustl.edu (David J. Camp): \> Does anyone know a way to determine whether you are in the login shell \> from .cshrc? -David- \In .cshrc say: \set login=0 \and in .login say: \set login=1 \Now \if ($login == 1) This doesn't work. Remember the question? "[...] determine [...] from .cshrc?" ^ ^^^^^^ = in My previous article is a general solution. However, there's another thing to consider: you want to set some alias in .cshrc - everytime a sub-csh is invoked -, but the alias depends on something which is best executed once, in .login; how do you handle it? My solution: # .cshrc if (! $?HOSTNAME) source ._login ... # ._login setenv HOSTNAME `hostname` ... Note: it's `._login' instead of `.login', because there might be some other statements in the latter that you don't want to get executed before the rest of .cshrc has been executed. Furthermore .login would get executed twice [to be prevented by another `if (! $?HOSTNAME)']. -- "Those who do not understand Henry |Maarten Litmaath @ VU Amsterdam: Spencer are condemned to reinvent DOS." |maart@cs.vu.nl, mcvax!botter!maart