]> git.ipfire.org Git - thirdparty/bash.git/blobdiff - tests/builtins5.sub
bash-5.2 distribution sources and documentation
[thirdparty/bash.git] / tests / builtins5.sub
index d36e03a5e525b5db42076ad855c3dbee1f71af48..4fcf793ddcfde2e478b50b592ada27f262e8ce53 100644 (file)
@@ -36,15 +36,25 @@ echo ${#a[@]}
 typeset -A B
 typeset -a b
 
+echo ${#B[@]}
+echo ${#b[@]}
+
 scalar1=foo
 scalar2=
 
+# this now checks for A[@] treating @ as a valid key - post-bash-5.1
 if [ -v A[@] ]; then echo assoc A; else echo assoc A unset; fi
 if [ -v a[@] ]; then echo array a; else echo array a unset; fi
 
+if [ ${#A[@]} -gt 0 ]; then echo assoc A; else echo assoc A unset; fi
+if [ ${#a[@]} -gt 0 ]; then echo array a; else echo array a unset; fi
+
 if [ -v B[@] ]; then echo assoc B; else echo assoc B unset; fi
 if [ -v b[@] ]; then echo array b; else echo array b unset; fi
 
+if [ ${#B[@]} -gt 0 ]; then echo assoc B; else echo assoc B unset; fi
+if [ ${#b[@]} -gt 0 ]; then echo array b; else echo array b unset; fi
+
 if [ -v scalar1[@] ]; then echo scalar 1; else echo scalar 1 unset; fi
 if [ -v scalar2[@] ]; then echo scalar 2; else echo scalar 2 unset; fi
 if [ -v scalar3[@] ]; then echo scalar 3; else echo scalar 3 unset; fi
@@ -71,4 +81,3 @@ echo scalar: ${#scalar3}
 echo scalar: ${#scalar3[@]}
 
 
-