Philosophical 'which' Guru question

Robert Nichols rnicholsNOSPAM at comcast.net
Tue Mar 31 05:07:37 UTC 2009


Bob Kinney wrote:
> The default installation creates the alias:
> alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
> 
> OK, so if you issue the 'which' command, it pipes the output of 'alias'
> into /usr/bin/which, which would be a list of aliases as arguments to the
> /usr/bin/which command, right?  
> 
> I am assuming that the argument to the 'which' command would be appended
> to the back end of the pipe, so 'which man' would expand to 
> 'alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde man'
> 
> The rest of the default aliases are pretty much useful variations of 'ls',
> but what is the point of this?
> 
> If I make an alias like 'foo=<print all of the man pages>' then wouldn't 
> this kind of wipe out the value of the which command?
> 
> It would seem from my rookie view that the intent of this alias is to include `pwd` in the 'which' search. 
> 
> Why do they include every alias definition as input to /usr/bin/which?

Look at the output from

       which ls

and contrast this with the output from

       \which ls

The second form bypasses the alias for "which" and invokes the command
directly.  Notice anything missing that might be important if you're
trying to see what gets invoked when you type "ls"?

-- 
Bob Nichols     "NOSPAM" is really part of my email address.
                 Do NOT delete it.




More information about the fedora-list mailing list