I can check if variable is empty:
var=("")
if [[ -z "${var}" ]];
then
echo "variable is empty"
else
echo "variable is not empty"
fi
Output:
variable is empty
But when I try to apply it to an element in an array, I get no output:
array=("")
for i in ${array[@]}
do
if [[ -z "${i}" ]];
then
echo "element in array is empty"
else
echo "element in array is not empty"
fi
done