bug-bash
[Top][All Lists]
Advanced

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

Re: Difference of extglob between 5.0.0(1)-release and 4.4.23(1)-release


From: Chet Ramey
Subject: Re: Difference of extglob between 5.0.0(1)-release and 4.4.23(1)-release
Date: Sun, 13 Jan 2019 14:42:22 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.3.3

On 1/13/19 8:45 AM, Ilkka Virta wrote:
> On 13.1. 14:37, Andreas Schwab wrote:
>> On Jan 13 2019, Robert Elz <kre@munnari.OZ.AU> wrote:
>>
>>> The pattern
>>>     ./$null"$dir"/
>>>
>>> is expanded (parameter expansion) to
>>>
>>>     ./@()./
>>>
>>> which does not have a "." immediately after the / and
>>> tus cannot match any filename (incoludeing ".") which
>>> starts with a '.' character.
>>
>> For the same reason `*.' doesn't match `.'.  Making `@()' work differently
>> from `*' would be surprising.
> 
> However,  ?(aa).foo  matches the file  .foo  in Bash 4.4 and 5.0 (and also
> in Ksh and Zsh), so extglob already breaks the above mentioned rule.

Yes. That was part of the overhaul of this code that I referred to in
my first reply. I found that in ksh93 the extglob operators *(...) and
?(...) will match the leading dot, so I implemented it that way for
compatibility.

> The change in Bash 5.0 also makes  @(aa|)  different from  ?(aa) , even
> though the distinction between those two doesn't appear immediately obvious.

My guess is the difference between those two operators in ksh93 is that
the @ has to match one of the patterns where the ? can match 0 occurrences.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/



reply via email to

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