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

Re: RC_EXPAND_PARAM bug



Bart Schaefer wrote about Re: RC_EXPAND_PARAM bug:
:On Jul 29,  7:47am, Geoff Wing wrote:
:} :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.

Yes, but I still don't get it.  ^^ should prevent expansion, shouldn't it.

  ${^spec}
	Turn on the RC_EXPAND_PARAM option  for  the evaluation  of  spec;
	if  the ^ is doubled, turn it off.  When this option is set, array
	expansions of the form foo${xx}bar, where the parameter xx is set
	to (a b c), are substituted with   fooabar   foobbar  foocbar
        instead of the default fooa b cbar.

So, it seems to me that it should be
  % echo 1${^a}
  1a 1b
  % echo 1${^a}1
  1a1 1b1
  % echo 1${^a}1${^x}
  1a1x 1a1y 1b1x 1b1y           #  in another order?
  % echo 1${^a}1${^^x}
  1a1x y 1b1x y 
-- 
Geoff Wing [mason@xxxxxxxxxxxxxxx]                   Phone    : +61-3-9818 2977 
 Technical Manager: PrimeNet Computer Consultants    Facsimile: +61-3-9819 3788 
 Web: <URL:http://www.primenet.com.au/>              Mobile   : 0412 162 441
        [ Boulderdash: <URL:http://ciips.ee.uwa.edu.au/~williams/bd/> ]



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