bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: wrong variable name in error message about unbound variable?


From: alex xmb sw ratchev
Subject: Re: wrong variable name in error message about unbound variable?
Date: Tue, 17 Oct 2023 16:31:35 +0200

On Tue, Oct 17, 2023, 16:30 Chet Ramey <chet.ramey@case.edu> wrote:

> On 10/17/23 8:43 AM, Zachary Santer wrote:
> > On Tue, Oct 17, 2023 at 8:00 AM Greg Wooledge <greg@wooledge.org> wrote:
> >
> >>      unicorn:~$ unset -v a b c array
> >>      unicorn:~$ a=b b=c c=42 array[a]=foo; declare -p array
> >>      declare -a array=([42]="foo")
> >>
> > What? What is Bash doing here? Dereferencing iteratively until it finds
> > something it can do arithmetic with?
>
> Identifiers in arithmetic expressions are treated as shell variables.
> The variable value is treated as an expression and evaluated to produce
> the result.
>

.. and i think all excepts -A assoc array are math evals

-- 
> ``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/
>
>
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]