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

Re: PATCH: -W option for zmv (updated)



On Mar 28,  5:12pm, Wayne Davison wrote:

> > x=(x x x x x x)
> > print ${(e)x//x/\$[++N]}
> 
> Thanks!  That's the nudge I needed to make things more efficient.
> 
> +  find='(#m)(\*\*#[/]|[*?]|\<[0-9]#-[0-9]#\>|\[(\[:[a-z]##:\]|\\\[|\\\]|[^\[\]]##)##\])\##'
> +  tmp="${pat//${~find}/$[++cnt]}"

and later

> +    integer N=0
> +    repl="${repl//${~find}/$open$[++N]$close}"

That doesn't work for me:

schaefer[501] find=x open=\$\{ close=\}
schaefer[502] repl=xxxxxx
schaefer[503] N=0
schaefer[504] repl="${repl//${~find}/$open$[++N]$close}"
schaefer[505] echo $repl
${1}${1}${1}${1}${1}${1}

It should be

repl="${(e)repl//${~find}/\$open\$[++N]\$close}"

Are you sure you sent the correct version of the patch?



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