I'm trying to use string substitution to combine an array. Output:
a,b,c
The below works, but isn't there a way to do with without piping?
#!/bin/bash
words=(a b c)
echo "${words[@]}" | sed 's/ /,/g'
I've tried this, which doesn't work.
echo "${words[@]// /,/}"