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

PATCH: addition to subscript documentation

I just noticed the following useful side effect of the += syntax for
associative arrays.

Index: Doc/Zsh/params.yo
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/params.yo,v
retrieving revision 1.17
diff -u -r1.17 params.yo
--- Doc/Zsh/params.yo	29 Oct 2002 10:31:16 -0000	1.17
+++ Doc/Zsh/params.yo	23 May 2003 11:37:48 -0000
@@ -257,6 +257,16 @@
 etc. flags), but it may also affect parameter substitutions that appear
 as part of an arithmetic expression in an ordinary subscript.
+It is possible to avoid the use of subscripts in assignments to associative
+array elements by using the syntax:
+   aa+=('key with "*strange*" characters' 'value string')
+This adds a new key/value pair if the key is not already present, and
+replaces the value for the existing key if it is.
 The basic rule to remember when writing a subscript expression is that all
 text between the opening `tt([)' and the closing `tt(])' is interpreted
 em(as if) it were in double quotes (\

Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 692070

The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential 
and/or privileged material. 
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by 
persons or entities other than the intended recipient is 
If you received this in error, please contact the sender and 
delete the material from any computer.

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