zsh-workers
 help / color / mirror / code / Atom feed
* */file glob and directory symlinks
@ 2019-06-28  9:24 Stephane Chazelas
  0 siblings, 0 replies; only message in thread
From: Stephane Chazelas @ 2019-06-28  9:24 UTC (permalink / raw)
  To: Zsh hackers list

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-06-28  9:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-28  9:24 */file glob and directory symlinks Stephane Chazelas

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).