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

Re: no way to keep my glob expanded ? (i don't think so)



2008/6/4 Marc Chantreux <marc.chantreux@xxxxxxxxxxxxxxxxxx>:
> hello zsh lovers,
>
> ${:-*c}            expands the glob and returns an array
> ${${:-*c}//truc/}  see *c as a string so the result is *c
>
> Clint and Peter explained me in another post that the subsitution is
> applied first. So:
>
> print ${:-*c}
> => print *c
> => glob expansion
>
> print ${${:-*c}//truc/}
> => print ${"*c"//truc/}
> => print "*c"
>
> as i understood thinks, it's impossible to do what i expected.
>
> ft gave a workaround on #zsh: print -l *c(e-'REPLY=${REPLY//truc/}'-)
> but i'm just curious:
>
> - did i correctly understand the problem ?
> - is it a way to visualize those multipass transformations ?
> - is there a way to tell to zsh to work as expected ?
>
> regards

You can use *c(:s/truc/) instead i think. (:gs/truc/) to match all
occurances, not just the first.

-- 
Mikael Magnusson



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