bug-bash
[Top][All Lists]
Advanced

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

Re: extglob patterns and dotfiles


From: Eric Cook
Subject: Re: extglob patterns and dotfiles
Date: Sun, 31 Dec 2017 22:36:13 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0

On 12/31/2017 01:47 PM, Chet Ramey wrote:
> On 12/29/17 6:55 PM, Eric Cook wrote:
>> When using an pattern that begin with an period in pattern-list, bash will 
>> include dotfiles in the results.
>> This doesn't seem to be the case with the various korn shells that i have 
>> seen. Since extglob is based on
>> ksh's extension to globbing, this appears to be an bug.
> 
> It's an interesting question. .c certainly doesn't match any of the
> subpatterns. I guess including a `.' as the leading character in the
> subpatterns shouldn't allow filenames beginning with `.' to be returned
> as not matching. I'll take a look.
> 
> Chet
> 

I guess the behavior is a little more subtle than that, with ksh93.

ksh93 $ touch a .c
ksh93 $ echo @(|.)!(b|c)
. .. a

I personally would expect .c being omitted since @(.|) is an logical or
of . and empty string. but at the moment with bash .c is still matched.

mksh, openbsd ksh and pdksh avoid the ambiguity(?) by not allowing dotfiles
to be matched at all with address@hidden() which i think bash probably
should not follow, since it historically does match dotfiles.

So to make my request more specific, i don't think the extglob !() should
match dotfiles when one of the patterns in the list is preceded with an period.
to be more ksh93-like.




reply via email to

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