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
Last activity: Jul 29, 2022, 12:16 PM