summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorPatrick McDermott <patrick.mcdermott@libiquity.com>2019-03-12 00:33:57 (EDT)
committer Patrick McDermott <patrick.mcdermott@libiquity.com>2019-03-12 00:33:57 (EDT)
commit96851fd522ae3540314ac5c5d4d4fbec1448ca4b (patch)
tree133f81dfcb2fec8e624a44df128c68faeb09e2ca /lib
parent71125c6f8e6c55e38a1b4be70c9d181de9ad358d (diff)
ob_set_substvar(): Replace sed with read
Diffstat (limited to 'lib')
-rw-r--r--lib/control.sh13
1 files changed, 3 insertions, 10 deletions
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}\""