home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / unix / shell / 3616 < prev    next >
Encoding:
Text File  |  1992-08-25  |  971 b   |  26 lines

  1. Newsgroups: comp.unix.shell
  2. Path: sparky!uunet!mcsun!sunic!ugle.unit.no!news
  3. From: Harald.Eikrem@delab.sintef.no
  4. Subject: Re: How to detect login shell in .cshrc ?
  5. In-Reply-To: ddb0248@mcnews.mcdata.com's message of 17 Aug 92 22:42:25 GMT
  6. Message-ID: <1992Aug25.235452*Harald.Eikrem@delab.sintef.no>
  7. Sender: news@ugle.unit.no (NetNews Administrator)
  8. Organization: SINTEF DELAB, Trondheim, Norway.
  9. References: <1992Aug17.224225.21915@mcnews.mcdata.com>
  10. Date: 25 Aug 92 23:54:52
  11. Lines: 13
  12.  
  13. ! Is there a clean way in your .cshrc to determine whether it is
  14. ! being executed by the login shell?  I have some commands that I 
  15. ! want to execute only if this is *not* the login shell.
  16. ! The best I could come up with is to run "ps" and count the number
  17. ! of lines it outputs after maybe grepping them for "csh".  Really ugly.
  18.  
  19. And the ugly answer is:  no.
  20.  
  21. In tcsh one might test $shlvl for value 1, but that will not always guarantee
  22. that it is a login shell.
  23.  
  24.   ~~harald E.
  25.