Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

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



On Fri, Jul 17, 2026 at 8:23 PM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
>
> On Fri, Jul 17, 2026 at 10:18 AM Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
> >
> > On Fri, Jul 17, 2026 at 6:33 PM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> > >
> > > On Fri, Jul 17, 2026 at 3:50 AM Vincent Lefevre <vincent@xxxxxxxxxx> wrote:
> > > >
> > > > while in <dir>/foo, I would want
> > > > to ignore only the cases where <dir> is a symbolic link.
> > >
> > > nosym() { [[ $REPLY:a:h == $REPLY:A:h ]] || typeset -g reply=() }
> >
> > 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=lfoo/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

-- 
Mikael Magnusson




Messages sorted by: Reverse Date, Date, Thread, Author