From 362fdf512ac720a50a1c1a49bc4637cc16f63d19 Mon Sep 17 00:00:00 2001
From: Patrick McDermott <patrick.mcdermott@libiquity.com>
Date: Mon, 18 Mar 2019 00:55:33 -0400
Subject: ob_set_substvar(): Replace echo with a here-document

---
(limited to 'lib')

diff --git a/lib/control.sh b/lib/control.sh
index 3395294..ab37ef3 100644
--- a/lib/control.sh
+++ b/lib/control.sh
@@ -201,7 +201,7 @@ ob_set_substvar()
 		)"
 
 	# Trim leading and trailing whitespace from value.
-	value="$(echo "${value}" | sed -n '
+	value="$(sed -n '
 		H;             # Store each input line in the hold space.
 		${             # At the last line of input:
 		  g;           # restore the hold space into the pattern space,
@@ -209,7 +209,10 @@ ob_set_substvar()
 		  s/[\n]*$//;  # remove trailing newline characters, and
 		  p;           # print the results.
 		};
-		')"
+		' <<-EOF
+		${value}
+		EOF
+		)"
 
 	eval "_OB_SUBSTVAR_${name}=\"\${value}\""
 
--
cgit v0.9.1