LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] which which

[ILUG] which which

Colm Buckley colm at tuatha.org
Tue Apr 25 12:47:45 IST 2000


> My main problem is the 'which' command; if I type 'which which', I'm told
> that it's an internal shell command. However, if I run 'newwhich which'
> (newwhich is a which I took from a different, secure box), it gives me
> '/usr/bin/which'.

Panic ye not.  'which' is frequently built-in to shells for speed - the
shell version will always tell you exactly what it's going to execute.
In the case of 'which' itself, this is obviously the shell built-in, as
they get executed in preference to executables in the PATH.

Your 'newwhich' command presumably works by looking in $PATH for an
executable of the given name.  It can't know about shell builtins, so
it'll return the one it finds in /usr/bin.  You'll probably find that
'/usr/bin/which which' will return '/usr/bin/which', too.

In short, your shell has a built-in 'which', which is what gets executed
when you run plain 'which'.  There's also an executable 'which' (in
/usr/bin), which only parses $PATH looking for executables, and can't
know about the shell built-ins.

        Colm

-- 
Colm Buckley BA BF | NewWorld Commerce, 44 Westland Row, Dublin 2, Ireland
colm at tuatha.org (personal) | colm.buckley at nwcgroup.com (business)
+353 87 2469146 | whois cb3765 | http://www.tuatha.org/~colm/
When I'm not in my right mind, my left mind gets pretty crowded.




More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell