Bash Scripting - Arrays
What is the correct way to iterate over all elements in a Bash array named
fruits?fruits?"${array[@]}" which expands each element as a separate word, preserving spaces."${fruits[@]}" correctly. Options B and C omit quotes or use ${fruits} or ${fruits[*]} without quotes, which can break elements with spaces. for fruit in fruits; do echo "$fruit"; done treats fruits as a string, not an array.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions