Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!spool.mu.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!unixhub!stanford.edu!neon.Stanford.EDU!calvin!zimmer From: zimmer@calvin.stanford.edu (Andrew Zimmerman) Newsgroups: comp.sys.next Subject: Re: Running .cshrc Keywords: .cshrc Message-ID: <1991May17.174631.20553@neon.Stanford.EDU> Date: 17 May 91 17:46:31 GMT References: <1991May17.125630.2977@socrates.umd.edu> Sender: news@neon.Stanford.EDU (USENET News System) Organization: Stanford University Lines: 39 In article <1991May17.125630.2977@socrates.umd.edu> fletcher@socrates.umd.edu (Charles Fletcher) writes: > >I'm Baaaaaaaaaaaaccccccccckkkkkkkkkkkkk!!!!!!!!!!!! > >After being away from the net for awhile I now have an account which >will post news. So here's my first return question: > >I know the .cshrc file is run when I start up terminal (since I still >run csh--got to get some time to look at bash). But at what other >times is it invoked. I would say "it isn't". However, it runs when >I use 'which', it runs when I print from TeXview, and probably at other >times. > The which command in /usr/ucb/which is a shell script, and as you mentioned, it does run your .cshrc. 1. Why does which use #!/bin/csh -f, and then go and source ~/.cshrc. What is the difference between that and just doing a #!/bin/csh? 2. If you take out the line that sources ~/.cshrc at the very least, which has problems with telling you about aliases. 3. You might be able to fix the problem you are having by changing your .cshrc. if(! $?0) then # the code in this section will only be run if csh doesn't know the # current input filename. This code will not be run when you # do the which command. # this is where you could put you background and printer power # commands endif I have tried the code I mention in part 3, and it seems to work. However, I am not a shell guru, and it might not work for all cases, or there might be an easier method. Andrew zimmer@calvin.stanford.edu