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:01:47 -0500
User-agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.3.3
On 1/19/19 11:54 PM, David Niklas wrote:
> On Sat, 19 Jan 2019 07:53:33 -0600
> Peng Yu <address@hidden> wrote:
>> Hi,
>>
>> Sometimes, if I just type the prefix then type TAB, there will be too
>> many commands shown. Is it possible to use * for command completion to
>> reduce the number of commands shown?
>>
>> For example, if I type "l*.sh", then type TAB, is it possible to show
>> all the commands starting with "l" and ending with ".sh"? Thanks.
>>
>
> For once Peng Yu has a great idea.
> Sadly, if there is such a way, I'm still searching for it...
You should be able to do it with a function specified with `complete -I',
but you'd have to roll your own $PATH splitting and then handle the other
cases with `-o bashdefault'.
Chet
--
``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/