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

Bug? Unexpected globbing duplicates



Hello!

I encountered a surprising result while using a glob expression, with
extended globs enabled, of duplicate resulting elements, where the
number of duplicates is proportional to the filesystem depth of that
result.

The expression I first observed this with pointlessly combines **/***/:

% vids=((#i)**/***/*(.mp4)(#q.))

Simply demonstrated, without extendedglob or qualifiers or flags:

% mkdir -p foo/bar/baz
% print -rl -- **/***/*

foo
foo/bar
foo/bar
foo/bar/baz
foo/bar/baz
foo/bar/baz

And thanks to danielsh and dana for pointing out, with **/**/:

% print -rl -- **/**/*

foo
foo/bar
foo/bar
foo/bar/baz
foo/bar/baz
foo/bar/baz

I know now there's no reason to have the extra leading **/ in either
case, and this problem does not present when done properly like that.

Thanks for reading,
Andy




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