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

Re: globbing for links in pathnames



Phil Pennock wrote:

> Typing away merrily, Bart Schaefer produced the immortal words:
> > D'oh!  I was distracted by attempting to get globbing to happen in the
> > right-side of ${x::=*(@)}, discovered that glob_assign wouldn't do it,
> > and then just left it there and typed the other solution.
>
> Okay, why do neither the second nor third ones here work "as expected"?
>
> % print -l ${(A)~x::=pkgs/*(@)}given that:
> pkgs/bar
> pkgs/foo
> % print -l ${(A)^~x::=pkgs/*(@)}/man
> pkgs/*(@)/man
> % print -l ${^${(A)~x::=pkgs/*(@)}}/man
> pkgs/*(@)/man
> %
>

 I can't tell you "why" this happens, but it seems that "how" it happens is
that the "/man" is being appended to the result of the parameter expansion
before globbing takes place. Evidently, when the ~ is processed it sets a flag
which allows globbing to happen further down the line, rather than forcing
globbing to happen at that point.

--
Andrew Gallagher
http://members.tripod.com/~AndrewGallagher/id.html






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