From 12736c48db116a1e72bfd799efa174f82f42b88e Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Mon, 18 Mar 2019 00:51:50 -0400 Subject: Revert "ob_set_substvar(): Replace sed with read" This reverts commit 96851fd522ae3540314ac5c5d4d4fbec1448ca4b. --- (limited to 'lib/control.sh') diff --git a/lib/control.sh b/lib/control.sh index b388705..78951bb 100644 --- a/lib/control.sh +++ b/lib/control.sh @@ -201,9 +201,16 @@ ob_set_substvar() )" # Trim leading and trailing whitespace from value. - read -r value <<-EOF - ${value} - EOF + # TODO: "read" can probably do this more simply. + value="$(echo "${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, + s/^[\n]*//; # remove leading newline characters, + s/[\n]*$//; # remove trailing newline characters, and + p; # print the results. + }; + ')" eval "_OB_SUBSTVAR_${name}=\"\${value}\"" -- cgit v0.9.1