summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McDermott <patrick.mcdermott@libiquity.com>2019-03-18 16:03:24 (EDT)
committer Patrick McDermott <patrick.mcdermott@libiquity.com>2019-03-18 16:03:24 (EDT)
commitc14e5780068625391ed8ef632b728add2e6c9ce5 (patch)
tree7d50cef5f480cc16f48af26edf3ed477967246d5
parent8bc3cf96d0d5efc798bf8510b7b10f2f4abb95fd (diff)
ob_set_source_substvar(): Replace here-documents with printf
-rw-r--r--lib/control.sh12
1 files changed, 3 insertions, 9 deletions
diff --git a/lib/control.sh b/lib/control.sh
index b5cc5d6..cd982e9 100644
--- a/lib/control.sh
+++ b/lib/control.sh
@@ -197,13 +197,10 @@ ob_set_source_substvar()
case "${name}" in *[!A-Za-z0-9-]* | '')
return 1
esac
- name="$(tr 'a-z-' 'A-Z_' <<-EOF
- ${name}
- EOF
- )"
+ name="$(printf '%s' "${name}" | tr 'a-z-' 'A-Z_')"
# Trim leading and trailing whitespace from value.
- value="$(sed -n '
+ value="$(printf '%s' "${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,
@@ -211,10 +208,7 @@ ob_set_source_substvar()
s/[\n]*$//; # remove trailing newline characters, and
p; # print the results.
};
- ' <<-EOF
- ${value}
- EOF
- )"
+ ')"
eval "_OB_SUBSTVAR_${name}=\"\${value}\""