[SunRescue] Locate for Solaris ??

Rich Lafferty rescue at sunhelp.org
Fri May 18 23:02:01 CDT 2001


On Fri, May 18, 2001 at 11:32:48PM -0400, Dave McGuire (mcguire at neurotica.com) wrote:
> On May 18, Rich Lafferty wrote:
> > No, "which" is a program for csh users which looks to see where
> > something would be in your path. (The sh equivalent is a builtin,
> > 'type').
> 
>   'which' isn't shell-specific.  In some operating systems, it's even
> a script or a binary rather than a shell builtin.

A builtin which(1) is a tcsh extension; you won't find it in pure
csh. On the other hand, I'd be very surprised to find a machine that
*didn't* have it as a standalone program. 

But it is shell specific.

>   I use bash, which is closer to sh than to csh, and I use which all
> the time. 

Well, you're welcome to do it, but I can't say I recommend it, since
you're not getting the information you want.

> On my Irix box, it's a shell script in /usr/bsd.

That'd be great on an Irix list. :-) From Solaris's which(1):

BUGS 
     Only aliases and paths from  ~/.cshrc  are  used;  importing
     from  the current environment is not attempted. Must be exe-    
     cuted by csh(1), since only csh knows about aliases.   

Interestingly, the IRIX 5.3 machine I've got access to shows

BUGS
     Must be executed by a csh, since only csh's know about aliases.
     Only aliases and paths from ~/.cshrc are used; importing from the
     current environment, .login, or /etc/cshrc isn't attempted.

What does 'whatis which' give you on your IRIX machine?

But even if it *is* nonstandard on IRIX, then machine to machine,
you've no idea what information you're getting. Ksh-derived shells
have 'type'; some also have 'whence'. Using those if you use sh-ish
shells is guaranteed to get you accurate information. With 'which'
you're at the mercy of your vendor, unless you use csh, in which case
it's appropriate.

Cheers,

  -Rich

-- 
------------------------------ Rich Lafferty ---------------------------
 Sysadmin/Programmer, Instructional and Information Technology Services
   Concordia University, Montreal, QC                 (514) 848-7625
------------------------- rich at alcor.concordia.ca ----------------------



More information about the rescue mailing list