summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/control.sh13
1 files changed, 10 insertions, 3 deletions
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}\""