[FC3] where is which??

Robert P. J. Day rpjday at mindspring.com
Mon Nov 29 22:19:24 UTC 2004


On Mon, 29 Nov 2004, Aleksandar Milivojevic wrote:

> akonstam at trinity.edu wrote:
> > The type command huh! you learn something new everyday. As long as you
> > are learning you can't die. At least that is my theory.
> >
> > But the which command works on my FC3 system.

might as well toss in my $0.02 here.  on most systems, "which" is an
external executable, while "type" is a shell builtin:

  $ type type
  $ type which

normally, this means that "which" can only tell you about other
external executables, while "type" can tell you about aliases, shell
functions and shell builtins as well, which makes it significantly
more useful.

in effect, because "type" lives inside the shell, it can tell you
about other things inside the shell, while "which" is restricted to
telling you about just the externals.  if that's all you care about,
fine.

in some cases, "which" is actually aliased to try to get back inside
the shell, as in:

$ alias which
alias which='alias | /usr/bin/which --tty-only ... etc etc.

what this is doing is (kind of) cheating to reach back inside the
shell to get at the current aliases.  which works, but it clearly
can't help you with builtins or shell functions:

  $ which type	 	# won't find it

and that's pretty much the story.

rday





More information about the users mailing list