From: andykluger@gmail.com
To: zsh-workers@zsh.org
Subject: Bug? Unexpected globbing duplicates
Date: Sat, 12 Feb 2022 12:31:23 -0800 [thread overview]
Message-ID: <CAO4D9Ekp5MVe4=6UDwuEMwt5ndRpK4-GaPz7RiDi0q-oHCxAxA@mail.gmail.com> (raw)
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
next reply other threads:[~2022-02-12 20:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-12 20:31 andykluger [this message]
2022-02-12 23:31 ` Bart Schaefer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAO4D9Ekp5MVe4=6UDwuEMwt5ndRpK4-GaPz7RiDi0q-oHCxAxA@mail.gmail.com' \
--to=andykluger@gmail.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).