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

*/file glob and directory symlinks



Hiya,

it's something that's been bothering me for a while:


$ mkdir dir
$ ln -s dir link
$ touch file dir/file

$ echo **/file
file dir/file

"link" is not followed, which is what I expect (same for
(*/)#file or (*/)##file). If I want the link to be followed, I
can use

$ echo ***/file
file dir/file link/file

Fine (though there's no link-following equivalent for (^CVS/)#
for instance)

Now in

$ echo */file
dir/file link/file

symlinks are always followed and there's no way to disable it,
other than doing things like

$ echo **/file~*/*/*
dir/file

which finds every file at any depth and then excludes the ones
at depth other 2 so is not really usable in practice.

These don't work:

$ echo (*/)file
zsh: bad pattern: (*/)file
$ echo (*/)(#c1)file
zsh: bad pattern: (*/)(#c1)file

Maybe we could have a glob qualifier that prevents following
symlinks, or support (*/) as the non-following variant of */
even when it's not followed by "#" or "##", or have per-path
component glob qualifiers like *(#q^@)/file (which could have
other uses like (*(#q^u:0:)/)#file to skip looking into dirs
owned by root)?

What do you think?

-- 
Stephane



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