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

Re: glob qualifier on intermediate directory / no symbolic links



2019-07-10 18:26:42 +0200, Mikael Magnusson:
> On 7/10/19, Pier Paolo Grassi <pierpaolog@xxxxxxxxx> wrote:
> > you can do something like this:
> >
> > setopt NULL_GLOB
> > typeset -a arr=(*(^@))
> > ls ${^arr}/file
> >
> > but I'm curious if there is any solution that doesn't require using an
> > intermediate array
> 
> There isn't.
[...]

Well, there is

ls -d -- (*/)##file~*/*/*

(a corrected version of the one I suggested in my related
zsh-workers thread at
https://www.zsh.org/mla/workers/2019/msg00501.html).

But I wouldn't call it "a solution".

That works because (*/)## doesn't follow symlinks, but obviously
that means crawling the whole directory tree while we only care
for depth 1.

-- 
Stephane



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