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 [@*?+!]() 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.