[FC3] where is which??
Aleksandar Milivojevic
amilivojevic at pbl.ca
Tue Nov 30 14:39:44 UTC 2004
Matthew Miller wrote:
> If you're using the standalone "which" package in FC (or even older RHL),
> though, you get:
>
> $ which ll
> alias ll='ls -l --color=tty'
> /bin/ls
>
> The best of both worlds -- shows you what the alias is, *and* which binary
> is going to get called.
That is because which package will add an alias to every user (see
/etc/profile.d/which-2.sh). Basically, it will first call alias command
and then it will call which, and that is what gives above output. But
it won't tell you about functions and shell built-ins. For example, try
"which type" and "type type" and see the difference. The /usr/bin/which
binary attempts to emulate which built-in command found in csh and tcsh.
But as an external command, it can do only so much. If you want which
functionality as found in csh and tcsh, use bourne shell equivalent: type.
If you can't live without which, better idea might be to implement which
command either as alias or as function inside your shell. Former if you
are OK with quick and dirty solution (something like "alias which=type",
later if you want to traslate "which" options to "type" options and
change the output of type so that it resembles that of which.
--
Aleksandar Milivojevic <amilivojevic at pbl.ca> Pollard Banknote Limited
Systems Administrator 1499 Buffalo Place
Tel: (204) 474-2323 ext 276 Winnipeg, MB R3T 1L7
More information about the fedora-list
mailing list