Re: Difference of extglob between 5.0.0(1)-release and 4.4.23(1)-release
On Jan 13 2019, Robert Elz 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. Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different."
Re: Difference of extglob between 5.0.0(1)-release and 4.4.23(1)-release
On 13.1. 14:37, Andreas Schwab wrote: On Jan 13 2019, Robert Elz 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. $ touch .foo aa.foo; bash -O extglob -c 'echo ?(aa).foo' aa.foo .foo The change in Bash 5.0 also makes @(aa|) different from ?(aa) , even though the distinction between those two doesn't appear immediately obvious. -- Ilkka Virta / itvi...@iki.fi
Re: Difference of extglob between 5.0.0(1)-release and 4.4.23(1)-release
On 1/13/19 8:45 AM, Ilkka Virta wrote: > On 13.1. 14:37, Andreas Schwab wrote: >> On Jan 13 2019, Robert Elz 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, CWRUc...@case.eduhttp://tiswww.cwru.edu/~chet/