Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [[ -x =command ]]



On 17/10/2007, Matthew Wozniski <godlygeek@xxxxxxxxx> wrote:


> mastermind% echo $commands[ls]
> /bin/ls
> mastermind% command -v ls
> alias ls='ls --color=auto -B'
>
> So, just for the sake of argument, if one were to have aliased `most'
> to `less' on a machine that didn't have most, the first form would
> work properly, but the second would result in a false positive and
> fail when an application tried to use $PAGER, since no alias expansion
> would be performed.


The canonical way to do this according to 'From Bash to Z Shell' (hi Peter)
is to use whence -p foo. Apparently, whence is what zsh uses internally,
anyway. If you are concerned about cluttering your $PAGER,
basename $(whence ls) is an option.


Richard



Messages sorted by: Reverse Date, Date, Thread, Author