This code is more lenient than bash. Examples: $ x[y[]= zsh: no matches found: x[y[]= $ x[][]= zsh: no matches found: x[][]= The proper solution is to look inside the [...] and make sure that all unescaped/unquoted square brackes are matched, but that is a heck of a lot more complicated than this simple 8-character patch.pull/131/head