Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!mintaka!ai-lab!life.ai.mit.edu!mycroft From: mycroft@kropotki.gnu.ai.mit.edu (Charles Hannum) Newsgroups: comp.sys.next Subject: Re: Running .cshrc Message-ID: Date: 24 May 91 08:02:21 GMT References: <1991May17.125630.2977@socrates.umd.edu> Sender: news@ai.mit.edu Organization: /home/fsf/mycroft/.organization Lines: 33 In-reply-to: fletcher@socrates.umd.edu's message of 17 May 91 12:56:30 GMT In article <1991May17.125630.2977@socrates.umd.edu> fletcher@socrates.umd.edu (Charles Fletcher) writes: 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. Anyone got any idea why this happens and what to do about it? I quote from the man page for which(1) (and, admittedly, I'm using an HP right now, so the NeXT's is sure to be more recent ;-/) Both aliases and path are determined by sourcing (executing) the user's .cshrc file. As for TeXview, I have no idea why it runs your .cshrc. Someone probably forgot to give csh a '-f' somewhere. Now, how do we fix this? Since presumable you'll still want which(1) to work, set your path, environment variables, and aliases first, and then insert the following: if (! $?prompt) exit Why? If csh is run interactively, it defines a shell variable 'prompt' which holds (of course) the current prompt. If run non-interactively, and assuming you haven't defined it yourself elsewhere, it will be undefined and thus the above statement will cause your .cshrc to exit.