[bugreport] declare -n z is inconsistent with the z
From: m To: bug-bash@gnu.org Subject: declare -n z is inconsistent with the z Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -g -O2 -fdebug-prefix-map=/build/bash-a6qmCk/bash-5.0=. -fstack-protector-strong -Wformat -Werror=format-security -Wall -Wno-parentheses -Wno-format-security uname output: Linux m 5.11.0-25-generic #27~20.04.1-Ubuntu SMP Tue Jul 13 17:41:23 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux Machine Type: x86_64-pc-linux-gnu Bash Version: 5.0 Patch Level: 17 Release Status: release Description: The `declare -n variable` call seems to have inconsistent behavior. Use the Repeat-By code to see a clear example. Repeat-By: Example code: ```bash declare -n z echo "${z}" # "" (empty) z="somevalue" echo "${z}" # "" (empty) declare -n z echo "${z}" # "" (empty) z="somevalue" echo "${z}" # "somevalue" ```
Re: [bugreport] declare -n z is inconsistent with the z
Scratch that. This is probably not a bug. I got an explanation on stackoverflow: https://stackoverflow.com/questions/68692482/what-does-the-bash-builtin-declare-n-z-do-with-the-z-parameter Thanks for the great work GNU! I wish you a nice day. With kindest regards, Melvin On Sun, Aug 8, 2021 at 3:27 PM Melvin wrote: > From: m > To: bug-bash@gnu.org > Subject: declare -n z is inconsistent with the z > > Configuration Information [Automatically generated, do not change]: > Machine: x86_64 > OS: linux-gnu > Compiler: gcc > Compilation CFLAGS: -g -O2 > -fdebug-prefix-map=/build/bash-a6qmCk/bash-5.0=. -fstack-protector-strong > -Wformat -Werror=format-security -Wall -Wno-parentheses -Wno-format-security > uname output: Linux m 5.11.0-25-generic #27~20.04.1-Ubuntu SMP Tue Jul 13 > 17:41:23 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux > Machine Type: x86_64-pc-linux-gnu > > Bash Version: 5.0 > Patch Level: 17 > Release Status: release > > Description: > The `declare -n variable` call seems to have inconsistent behavior. > Use the Repeat-By code to see a clear example. > > Repeat-By: > > Example code: > ```bash > declare -n z > echo "${z}" # "" (empty) > z="somevalue" > echo "${z}" # "" (empty) > > declare -n z > echo "${z}" # "" (empty) > z="somevalue" > echo "${z}" # "somevalue" > ``` > >
Re: [bugreport] declare -n z is inconsistent with the z
On 8/8/21 9:39 AM, Melvin wrote: Scratch that. This is probably not a bug. I got an explanation on stackoverflow: https://stackoverflow.com/questions/68692482/what-does-the-bash-builtin-declare-n-z-do-with-the-z-parameter Yes, the second assignment sets "somevalue=somevalue". -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRUc...@case.eduhttp://tiswww.cwru.edu/~chet/