I'm working on a script that requires me to have an array with a multi-word value in it. This needs to be treated on its own.
all=( "test phrase" 4 11 13 )
for i in ${all@]}; do
echo $i
done
I get out of it:
test
phrase
4
11
13
and I need to get:
test phrase
4
11
13
How can I do this?
You need quotes:
for i in "${all[@]}"; do
echo "$i"
done
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With