[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: |
Tue, 22 Jan 2019 14:06:21 -0500 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 |
On 1/22/19 12:26 PM, Peng Yu wrote:
>>> 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.
>
> For some reason, this code does not work for me.
>
> For example, when I type b*sh, then type TAB, it just clears up the
> command line by deleting "*sh". I only end up with "b" in the command
> line. Do you know what is wrong? Thanks.
You have multiple matches with the common prefix being `b'.
--
``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/
- [Help-bash] Command completion with * in the middle?, David Niklas, 2019/01/19
- Re: [Help-bash] Command completion with * in the middle?, Chet Ramey, 2019/01/20
- Re: [Help-bash] Command completion with * in the middle?, Grisha Levit, 2019/01/20
- Re: [Help-bash] Command completion with * in the middle?, Chet Ramey, 2019/01/20
- Re: [Help-bash] Command completion with * in the middle?, Peng Yu, 2019/01/22
- Re: [Help-bash] Command completion with * in the middle?,
Chet Ramey <=
- Re: [Help-bash] Command completion with * in the middle?, Peng Yu, 2019/01/22
- Re: [Help-bash] Command completion with * in the middle?, Chet Ramey, 2019/01/22
- Re: [Help-bash] Command completion with * in the middle?, Peng Yu, 2019/01/22
- Re: [Help-bash] Command completion with * in the middle?, Chet Ramey, 2019/01/22
- Re: [Help-bash] Command completion with * in the middle?, Peng Yu, 2019/01/22
- Re: [Help-bash] Command completion with * in the middle?, Koichi Murase, 2019/01/26
- Re: [Help-bash] Command completion with * in the middle?, Peng Yu, 2019/01/26
- Re: [Help-bash] Command completion with * in the middle?, Peng Yu, 2019/01/28
- Re: [Help-bash] Command completion with * in the middle?, doark, 2019/01/26
- Re: [Help-bash] Command completion with * in the middle?, Koichi Murase, 2019/01/26