2019-06-24 21:56:48 +0100, Harald van Dijk: > On 24/06/2019 21:15, Stephane Chazelas wrote: > > But that means that those ksh extended glob operators are not > > enabled in: > > > > pattern='@(x)'; cmd $pattern > > or > > case string in $pattern) ... > > > > (for the latter, that changed in ksh93 which makes it > > non-compliant; ksh88, pdksh, mksh are still OK). > > I do not see how it makes ksh93 non-compliant. Any use of this violates > 2.13.1's "The shell special characters always require quoting.", which is a > requirement on applications. As such, shells are free to interpret it in > whatever way they wish, and consideration should be given to this extension > when coming up with new wording for POSIX. [...]
That's not what it means. If it did, that would mean things like: text='foo bar' echo $text would be unspecified because of that "unquoted special character" (space) after expansion (and unquoted $ before expansion). Same for: IFS='|' text='foo|bar' for i in $text; do... "special character" is also not defined (or in the "Definitions" chapter refers to something different). * and ? are also refered to as special characters later on in the spec. That sentence makes little sense as written. SUSv2 (https://pubs.opengroup.org/onlinepubs/7908799/xcu/chap2.html#tag_001_013_001) again, was slightly clearer there by being more verbose which allowed the intention of the spec to be infered. It had this paragraph: } Conforming applications are required to quote or escape the } shell special characters (sometimes called metacharacters). If } used without this protection, syntax errors can result or } implementation extensions can be triggered. For example, the } KornShell supports a series of extensions based on parentheses } in patterns. Which explicitly refers to the @(...) and co. ksh operators. They meant that echo @(x) echo ${foo#@(x)} are unspecified for instance text='@(x)' echo $text is specified, and text='@(*)' echo $text is specified (to expand to the filenames that start with "@(" and end in ")". Again, in ksh88 (and pdksh and derivatives), those extended operators are only recognised when literal and unquoted, not when they're in the result of a word expansion. -- Stephane