From 96851fd522ae3540314ac5c5d4d4fbec1448ca4b Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Tue, 12 Mar 2019 00:33:57 -0400 Subject: ob_set_substvar(): Replace sed with read --- (limited to 'lib') diff --git a/lib/control.sh b/lib/control.sh index 9e8bb71..a20ea3c 100644 --- a/lib/control.sh +++ b/lib/control.sh @@ -215,16 +215,9 @@ ob_set_substvar() esac # Trim leading and trailing whitespace from value. - # 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. - }; - ')" + read -r value <<-EOF + ${value} + EOF eval "_OB_SUBSTVAR_${name}=\"\${value}\"" -- cgit v0.9.1