[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Consolidate recommended options?
From: |
Chet Ramey |
Subject: |
Re: Consolidate recommended options? |
Date: |
Tue, 31 Dec 2024 12:15:27 -0500 |
User-agent: |
Mozilla Thunderbird |
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 chet@case.edu http://tiswww.cwru.edu/~chet/
OpenPGP_signature.asc
Description: OpenPGP digital signature
Re: Consolidate recommended options?, Dale R. Worley, 2024/12/30
Re: Consolidate recommended options?, Chet Ramey, 2024/12/31