aboutsummaryrefslogtreecommitdiffstats
path: root/common/init
diff options
context:
space:
mode:
Diffstat (limited to 'common/init')
-rw-r--r--common/init9
1 files changed, 8 insertions, 1 deletions
diff --git a/common/init b/common/init
index e8f72c8..35662e2 100644
--- a/common/init
+++ b/common/init
@@ -30,6 +30,13 @@ die() {
printf "init: ERROR: %s\n" "$1"
exit 1
}
+quotify() {
+ input="$1"
+
+ # The quotes are actually fine like they are.
+ # shellcheck disable=SC1003
+ echo "$input" | awk '{ gsub(/'\''/, "'\''\\'\'''\''", $0); print("'\''" $0 "'\''"); }'
+}
# Prompt the user for a specific variable.
# ## Args:
@@ -57,7 +64,7 @@ prompt() {
LE "> " 0 " " "$pr_suggested_answer" ""
fi
- pr_new_variable="$(printf '%s="%s"' "$pr_variable_upper" "$REPLY")"
+ pr_new_variable="$(printf '%s=%s' "$pr_variable_upper" "$(quotify "$REPLY")")"
eval "$pr_new_variable"
printf "%s\n" "$pr_new_variable" >>"$replacement_file"