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

strange glob parsing



Thank you all for your hard work on zsh, a tool I use and appreciate every day.

I encountered an edge case in the parsing of globs, and I'm wondering whether this behavior is a bug, or if this is known/expected:

/bin % ls [^]
[
/bin % ls [^][^]
zsh: no matches found: [^][^]
/bin % ls [^][^][^][^][^]
cat     csh     ksh     pax     pwd     zsh

It appears that:
[^] alone is parsed as a character class of "all chars" (the same as ?), which is exactly what I expected, but
[^][^] is parsed as "all chars except ],[, and ^", rather than acting the same as ?? as I was expecting,
and n repeated [^] in a row matches n/2 + n%2 chars, (with the last char matching anything, and the rest matching anything except ],[, and ^).

If [^] isn't consistently equivalent to ?, it would be less astonishing if it was simply an error. So, is this a bug, or did I just "discover" a quirk that is known or maybe even expected?

- Ryan



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