Login shell?
Chris Torek
chris at mimsy.UUCP
Wed Oct 5 00:51:50 AEST 1988
In article <3ed799bc.103e8 at hi-csc.UUCP> mukul at hi-csc.UUCP (Mukul Agrawal)
writes:
>Is there a way ( /bin/csh , Sun Unix 3.4 ) to find out if the shell
>that is running is a login shell or not, just like one can use
>"$?prompt" to find out whether or not it is an interactive shell.
This is not completely foolproof, but will usually do the trick.
In your .cshrc:
if ($?CSHDEPTH) then
@ depth = $CSHDEPTH + 1
setenv CSHDEPTH $depth
unset depth
else
setenv CSHDEPTH 1
endif
For Bourne shell users, in .profile:
SHDEPTH=`expr ${SHDEPTH-0} + 1`; export SHDEPTH
It should be obvious how to modify this for a simple yes/no test,
although I prefer the more general solution.
--
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain: chris at mimsy.umd.edu Path: uunet!mimsy!chris
More information about the Comp.unix.questions
mailing list