티스토리 뷰
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 |
[Shell]join string array (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 |
댓글
250x250
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- 142,048
- Today
- 28
- Yesterday
- 221
TAG
- follower
- 김달
- 유투브
- Bot
- wlw
- 인스타그램
- 책그림
- 메디파크 내과 전문의 의학박사 김영수
- 어떻게 능력을 보여줄 것인가?
- 팔로워 수 세기
- Kluge
- 개리마커스
- 연애학개론
- COUNT
- 클루지