I have an array whose elements may contain spaces:
set ASD "a" "b c" "d"
How can I convert this array to a single string of comma-separated values?
# what I want: "a,b c,d"
So far the closest I could get was converting the array to a string and then replacing all the spaces. The problem is that this only works if the array elements don't contain spaces themselves
(echo $ARR | tr ' ' ',')