SyntaxFix
Write A Post
Hire A Developer
Questions
If you build the array in a loop, here is a simple way:
arr=() for x in $(some_cmd); do arr+=($x,) done arr[-1]=${arr[-1]%,} echo ${arr[*]}