From 90896bcfeb4e55c78d9a15700a6a4580f0df6365 Mon Sep 17 00:00:00 2001 From: Wojtek Kosior Date: Thu, 5 Aug 2021 20:44:25 +0200 Subject: enable modularization of html files --- shell_utils.sh | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 shell_utils.sh (limited to 'shell_utils.sh') 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 /.- _ +} -- cgit v1.2.3