Re: Filename generation: instruct zsh not to follow symbolic links?

Mikael Magnusson <[email protected]> Thu, 16 Jul 2026 02:57:46 +0200
Newsgroups gmane.comp.shells.zsh.devel,gmane.comp.shells.zsh.user
Message-ID <CAHYJk3Trh7f1w41Dg5oWKGYPquFhtq6CDLO9tVJwzBQe2uJqcA@mail.gmail.com>
On Thu, Jul 16, 2026 at 1:47=E2=80=AFAM Vincent Lefevre <[email protected]=
> 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.

fwiw, this is perfectly valid:
bing/(bar/)#foo
so the parsing might be less easy than you think. (Unless you were
thinking about looking for the )/ sequence? Maybe that would work, but
who can say for sure). I'm not exactly sure what you mean by "because
a slash cannot appear in a pathname component", are you referring to
the / inside the (/) or the one after? Because obviously all other
glob qualifiers are not the '/' character.

Also, you can already do this:
*(#q/)/foo
but the / still will not apply to the * instead of the foo (and in
fact does not apply to the foo either, not sure if it's intended to?).

--=20
Mikael Magnusson