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

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



On 2026-07-17 16:37:58 +0200, Mikael Magnusson wrote:
> 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:
> > > > > > 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 (/.

A pathname component is necessarily a directory or a symbolic link
to a directory, and I suppose that most users would want to select
only directories if they want some restriction at this point.

Anyway. To select only symlinked directories: *(/.,@)

A more complex example... To select only owner-writable directories
and symlinked directories: *(/w,@)

-- 
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Pascaline project (LIP, ENS-Lyon)




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