[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Consolidate recommended options?
From: |
microsuxxor |
Subject: |
Re: Consolidate recommended options? |
Date: |
Tue, 31 Dec 2024 22:42:35 +0100 |
i found it working if i $key in (( , not just '[key]'
i dunno i look for cmds to make em work ..
On Tue, Dec 31, 2024, 6:15 PM Chet Ramey <chet.ramey@case.edu> wrote:
> 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/
>
Re: Consolidate recommended options?, Dale R. Worley, 2024/12/30
Re: Consolidate recommended options?, Chet Ramey, 2024/12/31