[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: Paulo Marcel Coelho Aragão
Subject: Re: compgen -W doesn't split wordlist containing single quotes
Date: Sat, 17 Mar 2018 07:51:43 -0300
User-agent: NeoMutt/20170609 (1.8.3)

On Sat, Mar 17, 2018 at 12:16:24PM +0800, Clark Wang wrote:

> 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.

Oh, I hadn't realized that, you're right. My example was incomplete because 
when I realized that I had to sh-quote the words in wordlist, I used '-o 
filenames' in the comspec (I hit the original problem when I was completing 
filenames), which works:

complete -o filenames -W "foo\'bar aaa bbb" some-cmd

> Actually every word in the -W "wordlist" needs to be sh-quoted twice (with
> ``printf %q'' or the new address@hidden'' syntax). It'll be a bit easier if 
> you
> use an array.

You're right: it does work ! Hey, thanks for pointing out the address@hidden 
syntax: I wasn't aware of it. Had a look at the man page, and realized I didn't 
know about the address@hidden syntax.

This discussion was enlightening, thanks for that, Clark !


reply via email to

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