help-bash
[Top][All Lists]
Advanced

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

Re: [Help-bash] Behavior of 'complete -o filenames' unclear


From: Michael Siegel
Subject: Re: [Help-bash] Behavior of 'complete -o filenames' unclear
Date: Thu, 4 Oct 2018 17:50:01 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:60.0) Gecko/20100101 Thunderbird/60.0

Am 04.10.18 um 16:29 schrieb Chet Ramey:
> On 10/4/18 4:46 AM, Michael Siegel wrote:
> 
>> In that case, the shell will add a slash to the name, as if it were
>> completing directory names within $PWD:
>>
>> ~/devel/sandbox/probe$ ls
>> a_file  msiism/  tests/
>> ~/devel/sandbox/probe$ dbm msi<Tab>  # Results in 'dbm msiism/'
>> ~/devel/sandbox/probe$
>>
>> Now, the Bash Reference Manual does say that '-o filename' will "perform
>> any filename-specific processing"[1], "like adding a slash to directory
>> names"[1] and such. What I don't understand is why it is still adding
>> the slash when completion is based on file names in $dbm_dir instead of
>> $PWD.
> 
> How would readline (because readline is adding the slash) know that the
> possible completion should be interpreted relative to some other directory
> and not $PWD? It's not an absolute pathname, the current working directory
> hasn't changed, and there's not currently a way to direct readline
> otherwise.

My understanding was that specifying a list of possible completions
through 'compgen' would make the shell ignore $PWD for completions,
unless you use 'complete' with the 'default' option later.

The thing that appears odd to me here is: I'm telling the shell to use
only the file names that exist in $dbm_dir as possible completions for
arguments to 'dbm', but it's still looking for matches in $PWD.

Seems like I'm missing something about how these things work together.



reply via email to

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