Re: Filename generation: instruct zsh not to follow symbolic links?
Mikael Magnusson <[email protected]> Fri, 17 Jul 2026 20:56:44 +0200
| Newsgroups | gmane.comp.shells.zsh.user |
|---|---|
| Message-ID | <CAHYJk3QSTB7grq_wNCk7MaUUPAiORoa1PoJEjrWTXBd02A0chA@mail.gmail.com> |
On Fri, Jul 17, 2026 at 8:23=E2=80=AFPM Bart Schaefer <schaefer@brasslanter=
n.com> wrote:
>
> On Fri, Jul 17, 2026 at 10:18=E2=80=AFAM Mikael Magnusson <mikachu@gmail.=
com> wrote:
> >
> > On Fri, Jul 17, 2026 at 6:33=E2=80=AFPM Bart Schaefer <schaefer@brassla=
ntern.com> wrote:
> > >
> > > On Fri, Jul 17, 2026 at 3:50=E2=80=AFAM Vincent Lefevre <vincent@vinc=
17.net> wrote:
> > > >
> > > > while in <dir>/foo, I would want
> > > > to ignore only the cases where <dir> is a symbolic link.
> > >
> > > nosym() { [[ $REPLY:a:h =3D=3D $REPLY:A:h ]] || typeset -g reply=3D()=
}
> >
> > This might need to be :h:a and :h:A respectively, in case the foo
> > symlink target has multiple components?
>
> Hm, I don't think :A would resolve links in the final component of the
> path, only in <dir> along the way? Can you provide a counter-example?
> Or am I not understanding the concern?
% mkdir lfoo
% mkdir lfoo/baz
% ln -s baz/bing lfoo/foo
% a=3Dlfoo/foo
% touch lfoo/baz/bing
% echo $a:A
/tmp/a/lfoo/baz/bing
% echo $a:A:h $a:a:h
/tmp/a/lfoo/baz /tmp/a/lfoo
% echo $a:h:A $a:h:a
/tmp/a/lfoo /tmp/a/lfoo
--=20
Mikael Magnusson