Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Bug? Unexpected globbing duplicates
- X-seq: zsh-workers 49753
- From: andykluger@xxxxxxxxx
- To: zsh-workers@xxxxxxx
- Subject: Bug? Unexpected globbing duplicates
- Date: Sat, 12 Feb 2022 12:31:23 -0800
- Archived-at: <https://zsh.org/workers/49753>
- List-id: <zsh-workers.zsh.org>
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