summaryrefslogtreecommitdiff
path: root/replace_phrase.sh
diff options
context:
space:
mode:
Diffstat (limited to 'replace_phrase.sh')
-rwxr-xr-xreplace_phrase.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/replace_phrase.sh b/replace_phrase.sh
new file mode 100755
index 0000000..1b61476
--- /dev/null
+++ b/replace_phrase.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+set -e
+
+# phrase=$(cat phrase)
+phrase=${1:-"test phrase"}
+
+echo "$phrase"
+
+# if multiline
+# https://stackoverflow.com/questions/10107459/replace-a-word-with-multiple-lines-using-sed/#22901380
+# escapedPhrase="$(echo "${phrase}" | sed ':a;N;$!ba;s/\n/\\n/g' | sed 's/\$/\\$/g')"
+
+# just do oneline
+phrase=$(echo $phrase | tr "\n" " ")
+
+sed -i -e "s|\(<p id=phrase>\)\(.*\)\(</p>\)|\1${phrase}\3|" index.html