How do I join the result of ls -1 into a single line and delimit it with whatever I want?
ls -1
paste -s -d joins lines with a delimiter (e.g. ","), and does not leave a trailing delimiter:
paste -s -d
","
ls -1 | paste -sd "," -