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

Re: (AA) example



On Thursday, October 25, 2012, Mark van Dijk wrote:

> Hello list members,
>
> I'd like to ask for an example of how the A and AA parameter expansion
> flags work. The description in the manual is too complicated for me to
> grasp.
>
> I am not sure whether these flags can add a value to an (associative)
> array which already exists?
>

No, they cannot add to an existing parameter.  They always work as if
array=(values...), all or nothing.

The circumstances in which one would want to use these flags, especially
AA, are very limited.  They exist only for generality of the test-and-set
behavior of ${var=value}  -- if you can think of a case where you want to
substitute an entire associative array into a larger expression, you might
be able to find a corresponding example where you'd want AA.  Otherwise you
probably should be using ${ary[field]=value}, or assignment statements like
Peter described.


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