From 215667b3ef521962cde6b7db6350966fe9afb0e0 Mon Sep 17 00:00:00 2001 From: "Kay Marquardt (Gnadelwartz)" Date: Thu, 18 Jun 2020 11:51:19 +0200 Subject: [PATCH] direct read is faster than caching botconfig with updateArray --- bashbot.sh | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/bashbot.sh b/bashbot.sh index bf01654..3478d7d 100755 --- a/bashbot.sh +++ b/bashbot.sh @@ -11,7 +11,7 @@ # This file is public domain in the USA and all free countries. # Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying) # -#### $$VERSION$$ v0.98-dev-32-g6e3655f +#### $$VERSION$$ v0.98-dev-37-g3cd8dc9 # # Exit Codes: # - 0 sucess (hopefully) @@ -58,11 +58,8 @@ setConfigKey() { [[ "$1" =~ ^[-a-zA-Z0-9,._]+$ ]] || return 3 printf '["%s"]\t"%s"\n' "${1//,/\",\"}" "${2//\"/\\\"}" >>"${BOTDATABASE}.jssh" } -declare -A BASHBOTCONFIG getConfigKey() { [[ "$1" =~ ^[-a-zA-Z0-9,._]+$ ]] || return 3 - # cache if aupdateArray exists, else read from file - _exec_if_function jssh_updateArray_async "BASHBOTCONFIG" "${BOTDATABASE}" && printf '%s' "${BASHBOTCONFIG[${1}]}" && return [ -r "${BOTDATABASE}.jssh" ] && sed -n 's/\["'"$1"'"\]\t*"\(.*\)"/\1/p' <"${BOTDATABASE}.jssh" | tail -n 1 }