Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!snorkelwacker.mit.edu!bloom-picayune.mit.edu!athena.mit.edu!jik From: jik@athena.mit.edu (Jonathan I. Kamens) Newsgroups: comp.unix.shell Subject: Re: Is this a bug? SunOS 4.1.1 csh, which, and $?prompt Message-ID: Date: 5 May 91 22:28:22 GMT References: <1991May5.044113.15648@maverick.ksu.ksu.edu> Sender: news@athena.mit.edu (News system) Organization: Massachusetts Institute of Technology Lines: 27 In-Reply-To: tar@math.ksu.edu's message of 5 May 91 04:41:13 GMT The "which" command needs to execute your .cshrc, in order to get its hands on aliases and such, so it can tell you when it is aliased to something. Furthermore, it needs to execute the .cshrc with $prompt set, because so many people put "if ($ $?prompt) exit" at the top of their .cshrc file. Most shell scripts don't have to pretend they're interactive. "Which" is a special case, and therefore has special problems :-). How to solve it? Well, one thing that comes to mind is not to put stty commands in your .cshrc file. They should be in your .login file instead. If that's not possible, then set a variable such as STTY_SET after the first time you run stty, and then check if that variable is set in .cshrc before doing it. Something like this: if ($?prompt && (! $?STTY_SET)) then stty tostop erase ^H kill ^U setenv STTY_SET endif Jonathan Kamens USnail: MIT Project Athena 11 Ashford Terrace jik@Athena.MIT.EDU Allston, MA 02134 Office: 617-253-8085 Home: 617-782-0710