From 2e4ecc35396ea6a52903d91b4384dbfd0abdb970 Mon Sep 17 00:00:00 2001 From: "kebler.net" Date: Fri, 20 Jan 2023 10:09:56 -0800 Subject: [PATCH] add str_before and str_after --- modules/scripting/{bundle.sh => bundle.func} | 0 modules/scripting/{helpers.mod => helpers.lib} | 10 ++++++++++ 2 files changed, 10 insertions(+) rename modules/scripting/{bundle.sh => bundle.func} (100%) rename modules/scripting/{helpers.mod => helpers.lib} (94%) diff --git a/modules/scripting/bundle.sh b/modules/scripting/bundle.func similarity index 100% rename from modules/scripting/bundle.sh rename to modules/scripting/bundle.func diff --git a/modules/scripting/helpers.mod b/modules/scripting/helpers.lib similarity index 94% rename from modules/scripting/helpers.mod rename to modules/scripting/helpers.lib index 1a492b5..eb71b15 100644 --- a/modules/scripting/helpers.mod +++ b/modules/scripting/helpers.lib @@ -1,4 +1,13 @@ #!/bin/bash + +str_after () { +echo "$1" | cut -s -d "${2:-=}" -f2 +} + +str_before () { +echo "$1" | cut -s -d "${2:-=}" -f1 +} + # must be json as a string, depends on jq get_prop_value () { local value @@ -83,3 +92,4 @@ sed_ignore_comments () { eval $cmd < /dev/stdin fi } +