bug-bash
[Top][All Lists]
Advanced

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

self-reference to assoc.-array variable


From: kurt
Subject: self-reference to assoc.-array variable
Date: Thu, 15 Sep 2022 22:46:18 +0200
User-agent: Evolution 3.44.1-0ubuntu1

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -g -O2 -flto=auto -ffat-lto-objects -flto=auto 
-ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security 
-Wall 
uname output: Linux kurt-OptiPlex-7020 5.15.0-47-generic #51-Ubuntu SMP Thu Aug 
11 07:51:15 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu

Bash Version: 5.1
Patch Level: 16
Release Status: release

Description:
        a declaration like the following was possible before bash-version 5.1:
                declare -r -A MYAR=(
                  ['first']="NUMBER ONE"
                  # --- 'self-reference' to declaring array variable MYAR
                  ['top']="${MYAR['first']}"
                )
                echo "${MYAR[@]}"
        now bash complains with a syntax-error on the 
['top']="${MYAR['first']}" construct

Repeat-By:
        execute the above example-code




reply via email to

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