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

Re: zsh-3.1.5-pws-14: parameter expansion not working properly



Andrej Borsenkow <borsenkow.msk@xxxxxx> typed:
:Yes, as I understand, it was changed in pws-14. It includes full description
:of subst rules in Parameters expansion section of manual.
:Basically, in quotes, the value of inner substitution is always forced to be
:scalar for outer substitution unless some flags or modifiers (notably, =,
:(@), (s)) prevent it.
:> % zsh-3.1.5-pws-14
:> % a=("${(f@)$(echo foo; echo bar)}"); print -l $a
:> foo
:> bar
:So, it is not a bug, it is by desing. There was a long thread here, where I
:tried to understand what ZSH substitution rules actually are. I admit (now
::-) that current state is more or less consistent. The problem is, it is
:near to impossible to explain difference between pws-14 and earlier versions
:because it is the first time these rules are explicitly stated.

OK, thanks, so in Misc/compctl-examples, we now have something like the
following and I can happily (yeah!) complete in cvs again:

cvsentries () {
        setopt localoptions nullglob unset
        if [[ -f ${pref}CVS/Entries ]]
        then
		reply=("${pref}${(@)^${(@)${(@)${(f)$(<${pref}CVS/Entries)}:#D*}#/}%%/*}")
        fi
}

-- 
Geoff Wing   <gcw@xxxxxxxxx>            Mobile : (Australia) 0412 162 441
Work URL: http://www.primenet.com.au/   Ego URL: http://pobox.com/~gcw/



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