Path: utzoo!attcan!uunet!seismo!sundc!pitstop!sun!decwrl!labrea!rutgers!uwvax!oddjob!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.unix.questions Subject: Re: Login shell? Message-ID: <13851@mimsy.UUCP> Date: 4 Oct 88 14:51:50 GMT References: <3ed799bc.103e8@hi-csc.UUCP> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 26 In article <3ed799bc.103e8@hi-csc.UUCP> mukul@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@mimsy.umd.edu Path: uunet!mimsy!chris