From 622a3944948b036ee36e49d3d3aac58109fc5e52 Mon Sep 17 00:00:00 2001 From: "Kay Marquardt (Gnadelwartz)" Date: Wed, 17 Feb 2021 08:54:24 +0100 Subject: [PATCH] Bashbot Version 1.41 --- bin/process_update.sh | 3 +++ modules/jsonDB.sh | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/bin/process_update.sh b/bin/process_update.sh index 22b9898..29c68b5 100755 --- a/bin/process_update.sh +++ b/bin/process_update.sh @@ -34,6 +34,9 @@ print_help "${1:-nix}" json='{"result": ['"$(cat)"']}' UPDATE="$(${JSONSHFILE} -b -n <<<"${json}" 2>/dev/null)" +# escape bash $ expansion bug +UPDATE="${UPDATE//$/\\$}" + # assign to bashbot ARRAY Json2Array 'UPD' <<<"${UPDATE}" diff --git a/modules/jsonDB.sh b/modules/jsonDB.sh index dfaec7d..5162869 100644 --- a/modules/jsonDB.sh +++ b/modules/jsonDB.sh @@ -355,7 +355,7 @@ function jssh_updateArray_async() { Json2Array() { # match ["....."]\t and replace \t with = and print quote true false escape not escaped $ # shellcheck disable=SC1091,SC1090 - [ -z "$1" ] || source <( printf "$1"'=( %s )' "$(sed -E -n -e '/\["[-0-9a-zA-Z_,."]+"\]\+*\t/ s/\t/=/p' -e 's/=(true|false)/="\1"/' -e 's/([^\]|^)\$/\1\\$/g')" ) + [ -z "$1" ] || source <( printf "$1"'=( %s )' "$(sed -E -n -e '/\["[-0-9a-zA-Z_,."]+"\]\+*\t/ s/\t/=/p' -e 's/`//g' -e 's/=(true|false)/="\1"/' -e 's/([^\]|^)\$/\1\\$/g')" ) } # get Config Key from jssh file without jsshDB # output ARRAY as JSON.sh style data