Comment Comment by databasher Why not use bash's printf %q? string=$(printf ' %q' "${array[@]}") parent databasher 6 years ago