티스토리 뷰
728x90
#!/bin/bash
foo=('foo bar' 'foo baz' 'bar baz')
bar=$(printf ",%s" "${foo[@]}")
bar=${bar:1}
echo $bar
https://stackoverflow.com/questions/1527049/how-can-i-join-elements-of-an-array-in-bash
How can I join elements of an array in Bash?
If I have an array like this in Bash: FOO=( a b c ) How do I join the elements with commas? For example, producing a,b,c.
stackoverflow.com
728x90
'공부' 카테고리의 다른 글
[kotlin] avroUtils (/avsc) (0) | 2022.06.20 |
---|---|
[kotlin] merge json (0) | 2022.06.20 |
[Kotlin] add list + list (0) | 2022.06.19 |
[JavaScript] const result = await Promise.all([].map(i => async)) (0) | 2022.06.06 |
[git] git commit --signoff (0) | 2022.06.06 |
댓글