[Top][All Lists]

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

Re: compgen -W doesn't split wordlist containing single quotes

From: Chet Ramey
Subject: Re: compgen -W doesn't split wordlist containing single quotes
Date: Sat, 17 Mar 2018 13:18:07 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.6.0

On 3/17/18 12:16 AM, Clark Wang wrote:
> On Sat, Mar 17, 2018 at 1:00 AM, <address@hidden> wrote:
>> It works correctly if the single quote is itself quoted. Our test wordlist
>> would then be: "foo\'bar aaa bbb"
>> address@hidden:~/tmp$ compgen -W "foo\'bar aaa bbb" -- a
>> aaa
>> address@hidden:~/tmp$ compgen -W "foo\'bar aaa bbb" -- b
>> bbb
>> address@hidden:~/tmp$ compgen -W "foo\'bar aaa bbb" -- f
>> foo'bar
> This seems to work but it does not. For example in the command line
>   # some-cmd f<TAB>
> will become
>   # some-cmd foo'bar
> then you press ENTER and it'll still wait for another ' char.

You haven't told complete that you want the words to be quoted. If you
install the completion using the `-o filenames' option, you will get
filename-like quoting.

Readline doesn't provide a way to quote completion matches unless you
say they're filenames. Maybe it should, but that is the way things are.


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