Bash: Imploser une liste

list_implode () {
    SEPARATOR="$1"; shift
    LIST=( "$@" )
    RESULT="$(printf "${SEPARATOR}%s" "${LIST[@]}")"
    RESULT="${RESULT:${#SEPARATOR}}"
    echo "$RESULT"
}

LIST=( "foo" "bar" "with space" "fiz" "buz" )

echo "$(list_implode ", " "${LIST[@]}")"

Sortie :

foo, bar, foo bar, fiz, buz

blogroll

social