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

Re: RC_EXPAND_PARAM bug



On Jul 29,  3:36am, Zoltan Hidvegi wrote:
} Subject: Re: RC_EXPAND_PARAM bug
}
} > Can you generalize this rule for us?  E.g.
} > 
} > % echo ${^a}$[i++]$[++j]${^x}....
} > 
} > where .... is some arbitary number of other substitutions?  Is it just that
} > it now does everything from right to left instead of left to right?  Why?
} 
} No, it is left to right.  ${^a} is expanded first, then the remaining
} part, $[i++]$[++j]${^x} is expanded separately, and the result is
} combined with the expansion of ${^a}.  You can see it if you try
} 
} let i=0; echo $[i++]${^a}$[i++]
} 
} which gives
} 
} 0a1 0b1

I'm still not comprehending this.

Are you saying that all the variables are expanded first, left to right,
and then all the resulting strings are combined?  Whereas before (2.6 and
earlier) each variable would be expanded and combined with what followed,
and then the process repeated for each new string?

On Jul 29,  7:47am, Geoff Wing wrote:
} Subject: Re: RC_EXPAND_PARAM bug
}
} :The logic is that the string after the rc-param, 1${^^x}, is expanded,
} :producing two strings, 1x y, which is combined with 1a 1b.  It is true
} 
} I don't get this,  shouldn't 1${^^x} produce one string "1x y"?  And then the
} expansion of 1${^a}1${^^x} be the string "1a1x y 1b1x y"?  Your logic 
} indicates to me that it's producing array like thingies.  Is this dependant
} on some other wierd option?  Please explain before I go mental.

The trick there is that x is an array variable, so it produces two strings.
The setting of rcexpandparam doesn't affect that part.

zagzig% a=(a b)
zagzig% x=(x y)
zagzig% echo 1${^a}1${^^x}
1a1x 1ay 1b1x 1by
zagzig% echo 1${^a}1${^x} 
1a1x 1a1y 1b1x 1b1y


-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com



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