summaryrefslogtreecommitdiff
path: root/bin/strjoin
blob: ca316c4ef0e02fe6be874b5009ecac7645d7cf19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/bin/sh
sep=$1
shift
if [ $# -gt 0 ]
then	printf %s "$1"
	shift
	[ $# -gt 0 ] && printf -- "$sep"%s "$@"
else	read -r a
	printf '%s' "$a"
	while read -r a
	do	printf -- "$sep"'%s' "$a"
	done
fi