I considered help-bash for this, but I settled on bug-bash since it's about an in-development version.
a The expansion is a string consisting of flag values representing parameter's attributes.
If parameter is @ or *, the operation is applied to each positional parameter in turn, and the expansion is the
resultant list. If parameter is an array variable subscripted with @ or *, the case modification operation is
applied to each member of the array in turn, and the expansion is the resultant list.
But would seem to imply that each element is itself an array when they are clearly instead elements of an array. Without the subscript, only one "a" is output which is also consistent with the documentation.
For comparison:
$ printf '%s\n' "${colors[*]@A}"
declare -a colors=([0]="red" [1]="green" [2]="blue")
$ printf '%s\n' "${colors@A}"
declare -a colors='red'
Only one "-a" (of course). Curiously, when there's no subscript, only a single element is output which is consistent with long-standing Bash behavior, but there's that "-a" which is correct. I suppose it's a case of you get what you ask for.
$ neutral=gray
$ printf '%s\n' "${neutral[*]@A}"
neutral='gray'
$ printf '[%s]\n' "${neutral[*]@a}"
[]
In the "gray" example, the same result is given when the subscript is omitted, of course.
I guess the point I'm trying to get to is that I don't see how "${colors[*]@a}" or "${colors@A}" are useful whereas their opposites are ("${colors@a}" and "${colors[*]@A}") regardless of whether the parameter is an array or scalar. By the way, subscripting using "@" with these transformations also doesn't seem to be useful.
It may be that this is not a matter for changing the Bash code or documentation but that it's necessary to consider these behaviors when making good coding practice choices.
To tell me what attributes this name has: "${var@a}"
To tell me how to reproduce this name and its contents: "${var[*]@A}"
--
Visit
serverfault.com to get your system administration questions answered.