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

Re: creating associative arrays



"Akos Szalkai" wrote:
> I am trying to fill an associative array from a file.  If the name of
> the file is fixed, e.g. array.txt then the following works:
> 
> : ${(AA)dict::=$(<array.txt)}
> 
> However, if the filename is given in a parameter then the command:
> : ${(AA)dict::=$(<${filename})}
> gives the error
> zsh: bad set of key/value pairs for associative array.

There's not much that can go wrong there, if filename is set to array.txt
and that contains an even number of words.  Are you sure it is and does?
Sorry, I don't think this is very helpful...

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


**********************************************************************
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 
prohibited.  
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