On Thu, Oct 13, 2022 at 10:42:02AM -0400, Bryan Roessler wrote:
> Description:
> 
> bash-5.2# declare -A a
> bash-5.2# a[foo]=bar
> bash-5.2# [[ -v a[@] ]]; echo $?
> 1
> 
> bash-5.1# declare -A a
> bash-5.1# a[foo]=bar
> bash-5.1# [[ -v a[@] ]]; echo $?
> 0
> 
> If this is by design I missed it.

unicorn:~$ bash-5.2
unicorn:~$ declare -A a=([@]=at [foo]=bar)
unicorn:~$ [[ -v a[@] ]]; echo $?
0

What are you even trying to do there?  Determine whether the associative
array has 1 or more elements?  You can use ${#a[@]} for that, just like
with indexed arrays.

unicorn:~$ echo "${#a[@]}"
2

Reply via email to