bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to autocomplete after 'which'?


From: Eric Blake
Subject: Re: How to autocomplete after 'which'?
Date: Fri, 21 May 2010 11:05:20 -0600
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100430 Fedora/3.0.4-3.fc13 Lightning/1.0b1 Mnenhy/0.8.2 Thunderbird/3.0.4

On 05/21/2010 10:37 AM, Peng Yu wrote:
> On Fri, May 21, 2010 at 11:19 AM, Marc Herbert <Marc.Herbert@gmail.com> wrote:
>> Le 21/05/2010 16:25, Peng Yu a écrit :
>>> When I type something after 'which', something means a command.
>>> However, bash doesn't do command completion for the argument after
>>> 'which'. Is there a way to configure bash behave depending on the
>>> context (in this case, do autocomplete after 'which')?
>>
>> By the way it is better to use "type" instead of "which". "which" is
>> often misleading, compare for instance:
>>
>> type pwd
>> which pwd
>>
>> "which" is misleading in many other cases.
> 
> Since pwd is a shell command, when /bin/pwd is actually used? In
> shells that don't have built-in pwd?

In any context where you are exec'ing an external process; for example,
'env pwd', 'find . -exec pwd \;'.  POSIX requires that all shell
builtins that are not special builtins must also be available for
exec'ing; but it also warns that some utilities that are not special
builtins (like pwd, fg, ...) should still be regular shell builtins in
order to provide the full extent of semantics in the standard, and that
you lose some of those semantics when used under an exec.

-- 
Eric Blake   eblake@redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]