On Tue, 29 Aug 2023 11:24:43 -0400
Chet Ramey <chet.ra...@case.edu> wrote:

> If you want to check whether an array variable is set, you can check
> whether it has any set elements:
> 
> (( ${#assoc[@]} > 0 ))

This doesn't check whether an "array variable is set".

Not only that, but the test will be true in the case that assoc has been 
defined as a variable that is not an array.

$ unset -v assoc; assoc=; (( ${#assoc[@]} > 0 )); echo $?
0

-- 
Kerin Millar

Reply via email to