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

Re: (#m) and "case" alternation



On Tue, Nov 11, 2014 at 1:54 PM, Stephane Chazelas
<stephane.chazelas@xxxxxxxxx> wrote:
> Hello.
>
> Some unexpected behaviour:
>
> $ case abc in ((#m)a* | b*) echo $MATCH; esac
>
> $ case abc in ((#m)a* | (#m)b*) echo $MATCH; esac
> abc
> $ case abc in (a* | (#m)b*) echo $MATCH; esac
> abc
> $ case bcd in ((#m)a* | b*) echo $MATCH; esac
> bcd

I don't get "bcd" output for the last of these. Also a note to people
reproducing this, make sure to unset MATCH between each command; if
you run the second one and then the first one you'll get abc output
for both.

> (#b) is OK:
>
> $ case abc in (#b)(a)* | (#b)(b)*) echo $match; esac
> a
> $ case bcd in (#b)(a)* | (#b)(b)*) echo $match; esac
> b
> $ case abc in (#b)(a)* | (#b)(ab)*) echo $match; esac
> a
> $ case abc in (#b)(ab)* | (#b)(a)*) echo $match; esac
> ab
> $ case bcd in (#b)(ab)* | (b)*) echo $match; esac

-- 
Mikael Magnusson



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