티스토리 뷰

공부

[Shell] concat string arrays

승가비 2022. 6. 20. 00:28
728x90
countries=$(cat)
countries+=( "${countries[@]}" "${countries[@]}" )
echo ${countries[@]}

https://stackoverflow.com/questions/31143874/how-to-concatenate-arrays-in-bash

 

How to concatenate arrays in bash?

I am a new to Bash. I have an array taking input from standard input. I have to concatenate itself twice. Say, I have the following elements in the array: Namibia Nauru Nepal Netherlands NewZealand

stackoverflow.com

 

728x90
댓글
댓글쓰기 폼