On 12/29/24 4:34 PM, Lawrence Velázquez wrote:
I'm aware of the pitfalls described therein, and more. I don't think anyone thinks multiple evaluation in indexes is good per se, but many find the side effects of the attempted cures worse than the disease (e.g., https://mywiki.wooledge.org/BashPitfalls#pf62).
In its zeal to demonstrate how bad bash is, that little code snippet ignores the obvious solution: declare -A hash key=\'\] hash[$key]=17 (( hash[key]++ )) declare -p hash Since arithmetic evaluation performs its own expansion of identifiers. assoc_expand_once also works. But that wasn't really the point, was it? -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRU c...@case.edu http://tiswww.cwru.edu/~chet/
OpenPGP_signature.asc
Description: OpenPGP digital signature