Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Filename generation: instruct zsh not to follow symbolic links?
- X-seq: zsh-users 30720
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: Filename generation: instruct zsh not to follow symbolic links?
- Date: Fri, 17 Jul 2026 16:37:58 +0200
- Arc-authentication-results: i=1; mx.google.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=S66mQyBXlORn3+65G+93/W24DhNXbAPq2LOY9mMbaiM=; fh=yk3c4scJWo86Za4IR1HBNZw2a+GkUkfVQ7Fs3jnanfg=; b=JvoZDoxck2DJOii8wag5ne7/CCNnxgILpqdFVgKoPU1PYueQ5aATKeBJkrbIuzZW8x M+rQVs7bmMsVI0woCOWvjiv4t2q03AZxUat8ZdqAL7v41dgNcExlaQLoVpxDGxzdWSME qBsRhJ2v1m15Ldd0vmrOLQeboryHymbh/kDs2xKFeWM731A23JjMJPxjPB/g75OR2pbR CUokkXhmYvuk/nu12KXUQYmGYfoSvw6hTpGeDSD8zu6rMdy/6K1cg2cuWNPoPmVc1bGC XuypghY9F7bb9ZDV7EO5ETaQb3Mh7gNZewA1B01VQhF6aPFlR3JEVbTLHKZgAiloPsgF Xq8w==; darn=zsh.org
- Arc-seal: i=1; a=rsa-sha256; t=1784299093; cv=none; d=google.com; s=arc-20260327; b=ChegIqxBjQ0kpPfBODr8o1VfrAj4SQROzpETXR7UfY4O3ta/tf2zLP+vQLsxe4RbW+ bNW4R44rsPgRh5RycwLpM3pBI6rYHJpN7WiaWVsTcX7smpNGu/ZRwV6fTMhf9O+U22US pj1t365BXLspMlsuTbbBzG56HgSeHPvymZCddckZ7gSywX9S0jOvf6IUsl5FRHNvJtXQ Tcq9sR+4QwW1Kcq2q/rSBZ/t0OVDjChUWWU6oJB9VYr4kIy7hocmUGHjqSoosLqRvYJL vrPPpMFGYIJ22b6omj5E8X6ZjcaOL59skfouJFeEF+PZxFKXoL7xiR/FUk7ZrjBJWk7x Evbg==
- Archived-at: <https://zsh.org/users/30720>
- In-reply-to: <20260717094022.GD229319@qaa.vinc17.org>
- List-id: <zsh-users.zsh.org>
- References: <20260715231750.GB75013@qaa.vinc17.org> <CAHYJk3Trh7f1w41Dg5oWKGYPquFhtq6CDLO9tVJwzBQe2uJqcA@mail.gmail.com> <20260716092312.GA2955@cventin.lip.ens-lyon.fr> <CAHYJk3RjJOFvd9KYsjBgYPbkOsyo4BG30Jsy9uQ2U_-v-3h0UQ@mail.gmail.com> <20260716225724.GB229319@qaa.vinc17.org> <CAHYJk3RKK6Xko4yR1Ehb-9mphgq2f=YXzzrE=Uk=mYw0CYks6Q@mail.gmail.com> <20260717094022.GD229319@qaa.vinc17.org>
On Fri, Jul 17, 2026 at 12:10 PM Vincent Lefevre <vincent@xxxxxxxxxx> wrote:
>
> On 2026-07-17 02:47:20 +0200, Mikael Magnusson wrote:
> > On Fri, Jul 17, 2026 at 1:36 AM Vincent Lefevre <vincent@xxxxxxxxxx> wrote:
> > >
> > > On 2026-07-16 18:04:54 +0200, Mikael Magnusson wrote:
> > > > On Thu, Jul 16, 2026 at 11:35 AM Vincent Lefevre <vincent@xxxxxxxxxx> wrote:
> > > > >
> > > > > On 2026-07-16 02:57:46 +0200, Mikael Magnusson wrote:
> > > > > > On Thu, Jul 16, 2026 at 1:47 AM Vincent Lefevre <vincent@xxxxxxxxxx> wrote:
> > > > > > >
> > > > > > > In filename generation, is there a way to instruct zsh not to follow
> > > > > > > symbolic links?
> > > > > > >
> > > > > > > Unfortunately, it is not possible to use glob qualifiers on
> > > > > > > pathname components (except the last one, i.e. ending the pattern),
> > > > > > > e.g. *(/)/foo, even though there would be no ambiguity in parsing
> > > > > > > (because a slash cannot appear in a pathname component).
> > > > > >
> > > > > > No, but you can do things like
> > > > > > () { mycmd $^@/foo } *(/)
> > > > > > which conveniently doesn't need any named temporary parameters.
> > > > >
> > > > > I get "No such file or directory" errors for some directories.
> > > > > But this is too complex anyway, and perhaps not usable in some
> > > > > situations.
> > > >
> > > > Right, you might need
> > > > () { setopt localoptions cshnullglob; mycmd $^@/foo } *(/)
> > > > :)
> > >
> > > I still get "No such file or directory" errors; or if I use "echo"
> > > as the command, I get non-existing files in the output.
> >
> > It was implied that foo is a pattern in the above, in which case the
> > cshnullglob wil filter out the nonexistant ones.
>
> In my case, "foo" is not a pattern. The goal was to get all the
> files named "foo" in each subdirectory (which are not symlinks).
In that case you can for example do this:
() { setopt localoptions cshnullglob; mycmd $^@/foo(#q) } *(/)
the #q does nothing here, except make the word a glob pattern.
> > > > > I would rather think that a (/ sequence could have a special meaning.
> > > > > That should be easy to parse.
> > > >
> > > > Sure, but that'd be an extreme special case then. You wouldn't be able
> > > > to use any other glob qualifiers there.
> > >
> > > Why not?
> >
> > Because the other glob qualifiers are not '/' and hence will not match
> > the (/ sequence.
>
> This is not true:
>
> qaa% mkdir a b
> qaa% chmod 500 b
> qaa% ls -l
> total 8
> drwxr-xr-x 2 vinc17 vinc17 4096 2026-07-17 11:35:03 a
> dr-x------ 2 vinc17 vinc17 4096 2026-07-17 11:35:03 b
> qaa% ls -ld *(/)
> drwxr-xr-x 2 vinc17 vinc17 4096 2026-07-17 11:35:03 a
> dr-x------ 2 vinc17 vinc17 4096 2026-07-17 11:35:03 b
> qaa% ls -ld *(/w)
> drwxr-xr-x 2 vinc17 vinc17 4096 2026-07-17 11:35:03 a
'w' is not a '/', so I'm not sure what this is supposed to
demonstrate? How would you do the opposite of what you're currently
trying to do, finding foo only in symlinked directories? (^/ and (@
both don't start with (/.
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author