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.
a,b,c
Perhaps late for the party, but this works for me:
function joinArray() { local delimiter="${1}" local output="${2}" for param in ${@:3}; do output="${output}${delimiter}${param}" done echo "${output}" }