about summary refs log tree commit diff
path: root/mcom
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2017-05-26 15:42:39 +0200
committerLeah Neukirchen <leah@vuxu.org>2017-05-26 15:44:31 +0200
commitdf7cd7249c04cfe116aba64258b512c897fd9ef4 (patch)
treec5f99e1e0ae165be9decb28c68b309b52f39f984 /mcom
parent36e9a1afb000e7564f40e8835d0a17df5d74587c (diff)
downloadmblaze-df7cd7249c04cfe116aba64258b512c897fd9ef4.tar.gz
mblaze-df7cd7249c04cfe116aba64258b512c897fd9ef4.tar.xz
mblaze-df7cd7249c04cfe116aba64258b512c897fd9ef4.zip
mcom: commajoin: use awk
The sed solution did not work with OpenBSD sed and Plan9 sed when only
one line was used.
Diffstat (limited to 'mcom')
-rwxr-xr-xmcom4
1 files changed, 3 insertions, 1 deletions
diff --git a/mcom b/mcom
index 03823b7..892fee1 100755
--- a/mcom
+++ b/mcom
@@ -2,7 +2,9 @@
 # mcom [TO] - compose mail
 
 commajoin() {
-	sed ':a;N;s/\n/, /;$!b a'
+	awk 'NR==1 {l=$0; next}
+	     {l=l", "$0}
+	     END {print l}'
 }
 
 notmine() {