On Wed, 28 Apr 2010 00:13:16 +0200 Cyrille Lefevre wrote:
> Le 27/04/2010 17:15, David Korn a écrit :
> >> This worked up through the 2009-05-01 version:
> >> [[ \] == [x\]y] ]]&&  print ok
> >> It no longer works as of 2009-12-24.
> >
> > This change was need in order to align with the posix sh spec for [...].
> > the last sentence is the one in play:

> well, but he's talking about [[ ... ]] which isn't posix (yet),
> not [ ...] :-)
> IMHO, since [[ ... ]] is part of the shell syntax, it shoud be
> able make the difference of a close ] as it makes the difference
> of an empty $variable.

the issue is not the [[ ... ]] vs [ ... ] test operators
but instead the character class pattern
        [x\]y]
which is in posix, which states: the \ in that pattern is literal
so the pattern matches either of the literal sh strings
        'xy]'
        '\y]'
so these should print ok
        [[ 'xy]' == [x\]y] ]]&&  print ok
        [[ '\y]' == [x\]y] ]]&&  print ok
to match a literal ']' in a character class, place it first (after the optional 
! negation)
        [[ ']' == []xy] ]] && print ok
        [[ \] == []xy] ]] && print ok

_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users

Reply via email to