Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!purdue!bu-cs!madd From: madd@bu-cs.BU.EDU (Jim Frost) Newsgroups: comp.unix.questions Subject: Re: how can .cshrc know if session is a login? Message-ID: <31552@bu-cs.BU.EDU> Date: 21 May 89 21:45:15 GMT References: <434ccc08.bea3@mach1.engin.umich.edu> <14551@duke.cs.duke.edu> Reply-To: madd@bu-it.bu.edu (Jim Frost) Followup-To: comp.unix.questions Distribution: na Organization: Software Tool & Die Lines: 35 In article <14551@duke.cs.duke.edu> khera@cs.duke.edu (Vick Khera) writes: |In article <434ccc08.bea3@mach1.engin.umich.edu> brian@caen.engin.umich.edu (Brian Holtz) writes: |>Howw can .cshrc know if a session is a login session? | |A simple way I do this is to test for the existence of an environment |variable that gets set in .login such as NAME. My solution is: if ($?SUBSHELL) then # do things that a non-login shell should do else # do things a login shell should do setenv SUBSHELL "yes" endif This is particularly useful if you use SysV and don't have job control, but regularly use something like Emacs which exits as if job control existed: if ($?SUBSHELL) then alias % exit alias fg exit else alias % echo No current job. alias fg echo No current job. setenv SUBSHELL "yes" endif alias bg echo "Open the pod bay doors HAL. I can't do that, Dave" Just aliasing "%" and "fg" to "exit" has the annoying habit of logging you out. jim frost madd@bu-it.bu.edu