[comp.sys.sgi] which and the current directory

dale@lamont.ldgo.columbia.edu (dale chayes) (03/25/91)

I found (after too much exploration (;-)) that /usr/bsd/which will not
find an executable in the current directory if is specified in the 
environment's $path as in:

set path = (. ~/bin /usr/bsd /bin /usr/bin /usr/sbin /usr/local/bin)

The shell (at least csh) finds them with out trouble (as
long as they are really there!) 

How come? (I can't believe that this hasn't turned up before.
[4D/20, 3.3.1]

-- 
Dale Chayes Lamont-Doherty Geological Observatory of Columbia University
Route 9W, Palisades, N.Y.  10964	dale@lamont.ldgo.columbia.edu
voice:	(914) 359-2900 extension 434	fax: (914) 359-6817

vjs@rhyolite.wpd.sgi.com (Vernon Schryver) (03/25/91)

In article <3531@lamont.ldgo.columbia.edu>, dale@lamont.ldgo.columbia.edu (dale chayes) writes:
> I found (after too much exploration (;-)) that /usr/bsd/which will not
> find an executable in the current directory if is specified in the 
> environment's $path as in:
> 
> set path = (. ~/bin /usr/bsd /bin /usr/bin /usr/sbin /usr/local/bin)
> 
> The shell (at least csh) finds them with out trouble (as
> long as they are really there!) 
> How come? (I can't believe that this hasn't turned up before.


There must be something else going on, since it works for me.
No doubt you know that `set path = ..` does not set the environment
directly, but sets a csh variable that sets the environment variable PATH.

/usr/bsd/which is just a csh script.  It even has comments.
`csh -x /usr/bsd/which foobaz` might illuminate what is going on.


Vernon Schryver,   vjs@sgi.com

dale@lamont.ldgo.columbia.edu (dale chayes) (03/25/91)

Last night, I posted a note about problems with "which" not finding
files in the current directory:
> 
> In article <3531@lamont.ldgo.columbia.edu>, dale@lamont.ldgo.columbia.edu (dale chayes) writes:
> > 
> > I found (after too much exploration (;-)) that /usr/bsd/which will not
> > find an executable in the current directory if is specified in the 
> > environment's $path as in:
> > 
> > set path = (. ~/bin /usr/bsd /bin /usr/bin /usr/sbin /usr/local/bin)
> > 
> > The shell (at least csh) finds them with out trouble (as
> > long as they are really there!) 
> > 

	I got an e-mail message shortly after posting from Brendan (at sgi) 
confirming that which worked properly for him, so I dug deeper. 

	Which is a shell script (/usr/bsd/which) and SGI has added 
optional args including -f (but not -x) which is the "fast" version and 
does not source ~/.cshrc. Using this option, which did find the local prog. 
So, that meant that it was probably a problem with my very own .cshrc file.  
 
	I found that I was unconditionaly setting my prompt which everyone 
knows is not a "good thing" and can interfere with all kinds of programs 
and scripts. After I fixed my .cshrc not only did which work right, but 
M-x compile (in emacs) started working (the grand total of progress for
yesterday (;-)).

	This morning, Vern (at sgi) posted a note similar to Brendan's mail 
and I got an email message from Brent (at NASA) all confirming that which 
worked for them. 

	To all who replied, thanks.

Dale

-- 
Dale Chayes Lamont-Doherty Geological Observatory of Columbia University
Route 9W, Palisades, N.Y.  10964	dale@lamont.ldgo.columbia.edu
voice:	(914) 359-2900 extension 434	fax: (914) 359-6817