Login shell?

Vick Khera khera at macbeth.cs.duke.edu
Sun Dec 10 13:59:40 AEST 1989


In article <2975 at usceast.UUCP> sridhar at usceast.uucp.UUCP (M. A. Sridhar) writes:
>Is there any way to determine, within a shell script (csh), whether the script 
>is being executed by the login shell? I know that one can use the fact that
>$prompt is set to detect an interactive shell, but I don't know how to test
>whether it's the login shell.

the trick i use is to check for the existence of a particular environment
variable (such as NAME) that i set in my .login file, since it is run after
the .cshrc file is.  if this variable is set, then most likely the shell is
not a login shell, otherwise i assume it is.

							v.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Vick Khera                              Department of Computer Science
ARPA:   khera at cs.duke.edu               Duke University
UUCP:   ..!{mcnc,decvax}!duke!khera     Durham, NC 27706



More information about the Comp.unix.questions mailing list