[PATCH 1/3] email-sh-functions: make merge addresses work on multiple line inputs

Jacob Keller jacob.e.keller at intel.com
Fri Feb 7 13:42:19 PST 2014

This minor change fixes merge_addresses so that it can be used with
multiple line inputs. Basically this lets use ues formail to get the
address from multiple headers, and correctly merge the list into a comma
seperated value.

The primary usage for this change will come in a future patch which
introduces a method for getting the address out of multiple Cc headers.

Signed-off-by: Jacob Keller <jacob.e.keller at intel.com>
 email/aiaiai-email-sh-functions |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/email/aiaiai-email-sh-functions b/email/aiaiai-email-sh-functions
index 5474577..fe20e49 100644
--- a/email/aiaiai-email-sh-functions
+++ b/email/aiaiai-email-sh-functions
@@ -106,7 +106,7 @@ merge_addresses()
 	local addr1="$1"; shift
 	local addr2="$1"; shift
-	local list="$(printf "%s" "$addr1,$addr2" | LC_ALL=C tr -d "\n")"
+	local list="$(printf "%s" "$addr1,$addr2" | LC_ALL=C tr "\n" ",")"
 	printf "%s" "$list" | LC_ALL=C sed -e "s/,,/,/g" -e "s/^,//" \
 		                           -e "s/,$//" -e "s/[[:blank:]]\+/ /g"

More information about the aiaiai mailing list