zsh-workers
 help / color / mirror / code / Atom feed
From: Stephane Chazelas <stephane.chazelas@gmail.com>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: */file glob and directory symlinks
Date: Fri, 28 Jun 2019 10:24:13 +0100	[thread overview]
Message-ID: <20190628092413.7j6vcw2mx3vg3pmz@chaz.gmail.com> (raw)

Hiya,

it's something that's been bothering me for a while:


$ mkdir dir
$ ln -s dir link
$ touch file dir/file

$ echo **/file
file dir/file

"link" is not followed, which is what I expect (same for
(*/)#file or (*/)##file). If I want the link to be followed, I
can use

$ echo ***/file
file dir/file link/file

Fine (though there's no link-following equivalent for (^CVS/)#
for instance)

Now in

$ echo */file
dir/file link/file

symlinks are always followed and there's no way to disable it,
other than doing things like

$ echo **/file~*/*/*
dir/file

which finds every file at any depth and then excludes the ones
at depth other 2 so is not really usable in practice.

These don't work:

$ echo (*/)file
zsh: bad pattern: (*/)file
$ echo (*/)(#c1)file
zsh: bad pattern: (*/)(#c1)file

Maybe we could have a glob qualifier that prevents following
symlinks, or support (*/) as the non-following variant of */
even when it's not followed by "#" or "##", or have per-path
component glob qualifiers like *(#q^@)/file (which could have
other uses like (*(#q^u:0:)/)#file to skip looking into dirs
owned by root)?

What do you think?

-- 
Stephane

                 reply	other threads:[~2019-06-28  9:24 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20190628092413.7j6vcw2mx3vg3pmz@chaz.gmail.com \
    --to=stephane.chazelas@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).