[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: compgen -W doesn't split wordlist containing single quotes
From: |
Clark Wang |
Subject: |
Re: compgen -W doesn't split wordlist containing single quotes |
Date: |
Sun, 18 Mar 2018 10:49:13 +0800 |
On Sun, Mar 18, 2018 at 1:18 AM, Chet Ramey <chet.ramey@case.edu> wrote:
> On 3/17/18 12:16 AM, Clark Wang wrote:
> > On Sat, Mar 17, 2018 at 1:00 AM, <marcelpaulo@gmail.com> wrote:
> >
> >>
> >> It works correctly if the single quote is itself quoted. Our test
> wordlist
> >> would then be: "foo\'bar aaa bbb"
> >>
> >> paulo@monk:~/tmp$ compgen -W "foo\'bar aaa bbb" -- a
> >> aaa
> >> paulo@monk:~/tmp$ compgen -W "foo\'bar aaa bbb" -- b
> >> bbb
> >> paulo@monk:~/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.
>
`-o filenames' would append `/' to a word if the word is coincidentally a
real existing dir name. How can I ask it not to append the `/'?
-clark
>
> 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.
>
Re: compgen -W doesn't split wordlist containing single quotes, Chet Ramey, 2018/03/17