aboutsummaryrefslogtreecommitdiff
path: root/shell_utils.sh
diff options
context:
space:
mode:
authorjahoti <jahoti@tilde.team>2021-08-17 00:00:00 +0000
committerjahoti <jahoti@tilde.team>2021-08-17 00:00:00 +0000
commit5b7c9edbbb46074436b819435feb80ebbd9ab4ad (patch)
treecfa7ef034d99dc1957ce3b146256d766a6a8426d /shell_utils.sh
parent7796e55405e2c27f053122bdec25ffc06df92b4f (diff)
parent443bc095a72949adb4a007c9a19a43da7dd8843d (diff)
downloadbrowser-extension-5b7c9edbbb46074436b819435feb80ebbd9ab4ad.tar.gz
browser-extension-5b7c9edbbb46074436b819435feb80ebbd9ab4ad.zip
Merge remote-tracking branch 'origin/master' into jahoti
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 /.- _
+}