Sample Header Ad - 728x90

Why do I need to disable=SC2031

1 vote
1 answer
205 views
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 ] | @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?
Asked by Chris G. (163 rep)
Jul 29, 2022, 09:58 AM
Last activity: Jul 29, 2022, 12:16 PM