summaryrefslogtreecommitdiff
path: root/shell_utils.sh
diff options
context:
space:
mode:
authorWojtek Kosior <koszko@koszko.org>2021-08-05 20:44:25 +0200
committerWojtek Kosior <koszko@koszko.org>2021-08-05 20:44:25 +0200
commit90896bcfeb4e55c78d9a15700a6a4580f0df6365 (patch)
treef0dd83dbfb281521f2a79bba7fafcc0939802533 /shell_utils.sh
parent5957fbeeb47bb2c519d34ae4d2eada2433dd1e09 (diff)
downloadbrowser-extension-90896bcfeb4e55c78d9a15700a6a4580f0df6365.tar.gz
browser-extension-90896bcfeb4e55c78d9a15700a6a4580f0df6365.zip
enable modularization of html files
Diffstat (limited to 'shell_utils.sh')
-rw-r--r--shell_utils.sh39
1 files changed, 39 insertions, 0 deletions
diff --git a/shell_utils.sh b/shell_utils.sh
new file mode 100644
index 0000000..95e0d4e
--- /dev/null
+++ b/shell_utils.sh
@@ -0,0 +1,39 @@
+# Copyright (C) 2021 Wojtek Kosior
+# Redistribution terms are gathered in the `copyright' file.
+
+# This file is meant to be sourced in sh.
+
+ENDL="
+"
+
+errcho() {
+ echo "$@" >&2
+}
+
+map_set_instr() {
+ echo "$1__$2='$3'"
+}
+
+map_set() {
+ eval "$(map_set_instr "$@")"
+}
+
+map_set_export() {
+ eval "export $(map_set_instr "$@")"
+}
+
+map_get() {
+ eval "echo \"\$$1__$2\""
+}
+
+map_del_instr() {
+ echo "unset $1__$2"
+}
+
+map_del() {
+ eval "$(map_del_instr "$@")"
+}
+
+sanitize() {
+ echo "$1" | tr /.- _
+}