Length gotten from references to an value of an array is always 0

Ore Redstone <[email protected]>
Newsgroups gmane.comp.shells.bash.bugs
Message-ID <CA+0UbmAtnQ0ji-RSZkf=KQdOJXufjMKbqVLisPnD2_kyGAUgwQ@mail.gmail.com>
Dear GNU Team,
I'm using the name reference to get the length of an object from an array,
but it outputs `0`.
Here's an example:
```
$ b=(1 2 3)
$ echo "${#b[2]}"
1
$ declare -ng c=b[2]
$ echo $c
3
$ echo ${#c} # Expected result: 1
0
$ declare -ng c=b
$ echo ${#c} # This works
1
$ # I need to use this and it's O(n):
$ d=$c
$ echo "${#d}"
1
$ echo $BASH_VERSION
5.2.21(1)-release
$ uname -a
Linux SECRET 6.6.87.2-microsoft-standard-WSL2 #1 SMP PREEMPT_DYNAMIC Thu
Jun  5 18:30:46 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
```
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.