I'm having trouble getting the value of a variable into an array in Bash (I'm using bash v3.2.25).
I have some output from a command, piped into:
while read domain; do domains=("${domains[@]}" "domain"); done
But then echo ${#domains[@]}
returns 0.
I've also tried various forms of:
while read domain; do domains+=($domain); done
with all sorts of attempts at quoting and double quoting, but no matter what, the domains array stays empty.
What am I doing wrong?