[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] Performing quote removal on data
From: |
Maarten Billemont |
Subject: |
Re: [Help-bash] Performing quote removal on data |
Date: |
Wed, 28 May 2014 16:49:49 -0400 |
On May 28, 2014, at 4:44 PM, Greg Wooledge <address@hidden> wrote:
> On Wed, May 28, 2014 at 04:05:47PM -0400, Maarten Billemont wrote:
>> 2a. One such case is doing pathname completion, but here we can fall back to
>> compgen -o bashdefault:
>>
>> IFS=$'\n' read -r -d '' COMPREPLY < <(compgen -o bashdefault "$partial*") #
>> notice the trailing *
>
> I think you've taught me that I don't know a damned thing about bash
> programmable completion.
>
> imadev:~/tmp$ mkdir -p "dir "{1,2}
> imadev:~/tmp$ echo dir*
> dir 1 dir 2
> imadev:~/tmp$ compgen -o bashdefault "di"
> imadev:~/tmp$ compgen -o bashdefault "di*"
> imadev:~/tmp$ compgen -o default "di"
> dir 1
> dir 2
> imadev:~/tmp$ compgen -o default "di*"
> imadev:~/tmp$ rmdir dir\ [12]
>
> Sorry if I misunderstood the goal. Apparently, I don't understand the
> compgen command either.
>
> Good luck.
Interesting. You're probably running an older bash version then, because for
me:
$ mkdir -p "dir "{1,2}
$ echo dir*
dir 1 dir 2
$ compgen -o bashdefault "di"
$ compgen -o bashdefault "di*"
dir 1
dir 2
$ compgen -o default "di"
dir 1
dir 2
$ compgen -o default "di*"
So it appears we can only really rely on -o default "$partial", but then
pathname expansion is definitely out.
I do expect that your bash completes echo dir*[tab] and gives you dir 1 and dir
2 as completion options?
— Maarten Billemont (lhunath) —
me: http://www.lhunath.com – business: http://www.lyndir.com –
http://masterpasswordapp.com
signature.asc
Description: Message signed with OpenPGP using GPGMail
- [Help-bash] Performing quote removal on data, Maarten Billemont, 2014/05/28
- Message not available
- Re: [Help-bash] Performing quote removal on data, Maarten Billemont, 2014/05/28
- Re: [Help-bash] Performing quote removal on data, Greg Wooledge, 2014/05/28
- Re: [Help-bash] Performing quote removal on data, Maarten Billemont, 2014/05/28
- Re: [Help-bash] Performing quote removal on data, Greg Wooledge, 2014/05/28
- Re: [Help-bash] Performing quote removal on data,
Maarten Billemont <=
- Re: [Help-bash] Performing quote removal on data, Greg Wooledge, 2014/05/28
- Re: [Help-bash] Performing quote removal on data, Maarten Billemont, 2014/05/28
- Re: [Help-bash] Performing quote removal on data, Greg Wooledge, 2014/05/29
- Re: [Help-bash] Performing quote removal on data, Chet Ramey, 2014/05/30
- Re: [Help-bash] Performing quote removal on data, Chet Ramey, 2014/05/30