As per the below outputs, look like only ZONES1 is array, the other two are string, why?
$ ZONES0=$(aws ec2 describe-availability-zones --region ap-southeast-2 --query AvailabilityZones[*].ZoneId[] --output text)
echo ${ZONES0[0]}
apse2-az3 apse2-az1 apse2-az2
$ ZONES1=(`aws ec2 describe-availability-zones --region ap-southeast-2 --query AvailabilityZones[*].ZoneId[] --output text`)
$echo ${ZONES1[0]}
$ apse2-az3
$ ZONES2=$(aws ec2 describe-availability-zones --region ap-south-1 | jq -r '.AvailabilityZones[].ZoneId')
$echo ${ZONES2[0]}
aps1-az1 aps1-az3 aps1-az2
If I run
ZONES0=( $(aws ec2 describe-availability-zones --region ap-southeast-2 --query AvailabilityZones[*].ZoneId[] --output text) ).
the output is below
$ echo $ZONES0
apse2-az3
$ echo $ZONES0[0]
apse2-az3[0]