help-bash
[Top][All Lists]
Advanced

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

Re: [Help-bash] Command completion with * in the middle?


From: Chet Ramey
Subject: Re: [Help-bash] Command completion with * in the middle?
Date: Sun, 20 Jan 2019 17:50:00 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.3.3

On 1/20/19 5:48 PM, Grisha Levit wrote:
> On Sat, Jan 19, 2019 at 11:54 PM David Niklas <address@hidden> wrote:
> 
>> Sadly, if there is such a way, I'm still searching for it...
>>
> 
> I think something like this does the trick?
> 
>     f() { COMPREPLY=($(compgen -c -X '!'"$3")); }
>     complete -I -F f -o bashdefault
> 
> i.e. generate all commands and then remove the ones that don't match the
> pattern supplied.

Ooh, that's clever.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    address@hidden    http://tiswww.cwru.edu/~chet/



reply via email to

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