Can you tell me, why I have to # shellcheck disable=SC2030 in the following script?
get_names_and_hosts(){
unset LOCAL_HOSTS
declare -a LOCAL_HOSTS
unset LOCAL_NAMES
declare -a LOCAL_NAMES
multipass list --format json | jq -r '.list[] | [ .name, .ipv4[0] ] | @tsv' |
while IFS=$'\t' read -r name ipaddress; do
# shellcheck disable=SC2030
LOCAL_NAMES+=("$name")
# shellcheck disable=SC2030
LOCAL_HOSTS+=($ipaddress)
done
# shellcheck disable=SC2031
reply=("${LOCAL_NAMES[@]}" "${LOCAL_HOSTS[@]}")
echo "${reply[@]}"
}
declare as declare -gx gives the same warning?