Quantcast
Viewing all articles
Browse latest Browse all 9

Print array elements on separate lines in Bash?

How do I print the array element of a Bash array on separate lines? This one works, but surely there is a better way:

$ my_array=(one two three)$ for i in ${my_array[@]}; do echo $i; doneonetwothree

Tried this one but it did not work:

$ IFS=$'\n' echo ${my_array[*]}one two three

Viewing all articles
Browse latest Browse all 9

Trending Articles