help-bash
[Top][All Lists]
Advanced

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

Re: [Help-bash] $<space><tab> completes to files rather than commands


From: Chet Ramey
Subject: Re: [Help-bash] $<space><tab> completes to files rather than commands
Date: Mon, 16 Jul 2018 14:15:05 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

On 7/16/18 10:43 AM, Michal Pesa wrote:
> Hello.
> 
> Please take a look at the following scenarios where "$" is the beginning of
> the prompt:
> 
> 1) $<tab> # complete -E will be used
> 
> 2) $p<tab> # commands beginning with "p" will be completed
> 
> 3) $<space>p<tab> # commands beginning with "p" will be completed again
> 
> 4) $<space><tab> # all files in the current dir (for some reason) will be
> completed
> 
> Why doesn't 4) complete to all possible commands instead of all files since
> it's the first word on the line?

It's not an empty line -- point and end are not at column 0 -- so the
compspec supplied with -E won't be used. Bash-4.4 has a logic flaw that
causes it to assume that filename completion is desired when programmable
completion is active and the command name is empty. This is fixed in
bash-5.0-alpha.

> Is the completion of the first word
> configurable at all (not counting complete -E)? Let's say I wanted $p<tab>
> to complete only to a subset of commands I choose.

Recent devel branch pushes (not in bash-5.0-alpha) have a `complete -I'
option to install a  compspec that will be used on the initial word. Read
the discussion starting at

http://lists.gnu.org/archive/html/bug-bash/2018-06/msg00003.html

for more information.

-- 
``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]