Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: What's wrong with this expression?



On 2011-10-17 at 19:27 -0200, Daniel Serodio (lists) wrote:
> Mikael Magnusson wrote:
> > On 17 October 2011 23:09, Daniel Serodio (lists)
> >>     [[ "foo" ~= "x" ]]&&  echo true

> Ooops. Error copy'n'pasting. The actual line in the script that fails is:
> 
>      if [[ ! "${PATH}" =~ $regex ]] ; then

See, this is why reporting the _actual_ code which causes an error
helps; or, if you want to simplify, at least test that the failure still
happens with the simplified version.

This was a bug, fixed on 2010-10-10 and the fix included in the release
of zsh 4.3.11.  The current version of zsh is 4.3.12.  Negated patterns
and tests combined with &&/|| failed prior to that when using the =~
operator.

If you are running 4.3.11 or newer, please state which version you're
using and preferably show the minimum needed to reproduce, starting from
"zsh -f".



Messages sorted by: Reverse Date, Date, Thread, Author