Path: utzoo!attcan!uunet!mcvax!hp4nl!botter!star.cs.vu.nl!maart From: maart@cs.vu.nl (Maarten Litmaath) Newsgroups: comp.unix.questions Subject: Re: Login shell? Message-ID: <1529@solo9.cs.vu.nl> Date: 14 Oct 88 22:05:18 GMT References: <3ed799bc.103e8@hi-csc.UUCP> <13851@mimsy.UUCP> <511@imec.UUCP> Reply-To: maart@cs.vu.nl (Maarten Litmaath) Organization: VU Informatica, Amsterdam Lines: 33 In article <511@imec.UUCP> croes@imec.UUCP (Kris Croes) writes: \A way to detect whether your .cshrc is executed the first time, or whether \it is executed with a "source .cshrc" e.g. after you edited it is: \ \< 1> # Test if new csh. \< 2> set temp = /tmp/prompt$$ \< 3> history 1 > $temp \< 4> if (-z $temp) then \< 5> # This is the first time .cshrc is executed \< 6> alias lpr `which lpr` \!\* \& \< 7> else \< 8> # This is when .cshrc is executed with 'source' \< 9> endif \<10> /bin/rm $temp \<11> unset temp The above can be done much easier, without the temp file: ------------------------------cut here------------------------------ if ($?history) then echo You sourced .cshrc! else echo This is the first time! set history=1 # or more :-) endif ------------------------------cut here------------------------------ \The Demon King sends a "rm -r /" to your shell. A "/bin/rm -rf $HOME" is more effective, in general :-) -- Hippic sport: |Maarten Litmaath @ Free U Amsterdam: a contradiction in terms.|maart@cs.vu.nl, mcvax!botter!maart