2020-02-19 17:18:14 +0100, Ulrich Mueller:
[...]
> So, is there any syntax that allows to test if a value has been assigned
> to the array variable? Especially, to distinguish VARNAME=() (empty
> array) from VARNAME being unset?
[...]

You could do:

if typeset -p var 2> /dev/null | grep -q '='; then
  echo var has a value
fi

For namerefs, that's whether they are referencing a variable,
that variable could still be undeclared (let alone set).

-- 
Stephane

Reply via email to