I'm trying to use Bash string substitution to combine an array. Desired output:
cat,dog,fish
This works, but isn't there a way to do with without piping?
#!/bin/bash
words=(cat dog fish)
echo "${words[@]}" | sed 's/ /,/g'
I've been trying this, which doesn't work.
echo "${words[@]// /,/}"