티스토리 뷰

공부

[Sh] array loop

승가비 2022. 5. 22. 18:15
728x90
arr=(one two three)

for i in ${arr[@]}
do 
  echo $i; 
done

https://stackoverflow.com/questions/15691942/print-array-elements-on-separate-lines-in-bash

 

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; done one two...

stackoverflow.com

 

728x90
댓글
댓글쓰기 폼