On 1/12/19 12:17 AM, Peng Yu wrote: > See the following for the difference. I'd consider the behavior of > 4.4.23 should be correct.
The bash-4.4 code only worked the way you want it by chance. There was a bug that was fixed in January, 2017, the result of http://lists.gnu.org/archive/html/bug-bash/2017-01/msg00018.html that uncovered the behavior you're complaining about. I am not sure of your characterization of the bash-4.4 behavior as correct. In a filename context, or a context where a leading `.' must be matched explicitly, a pattern must only match a filename that starts with a `.' if `.' is the first character in the pattern. A pattern that begins with a null extglob pattern (especially one that is defined to perform at least one match) followed by a dot, quoted or unquoted, does not fulfill that criterion. > > How was this bug introduced? Should there be a test case to cover this case? I wouldn't be so quick to declare this a bug. Other shells (e.g, ksh93, mksh, and zsh) that implement extended globbing patterns behave like bash-5.0 does. There is a question of whether or not an extglob pattern that is allowed to make zero matches followed by a `.' should succeed, and the existing implementations are mixed on that point. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRU c...@case.edu http://tiswww.cwru.edu/~chet/