mirror of
https://github.com/octoleo/telegram-bot-bash.git
synced 2024-12-02 03:18:18 +00:00
Json2Array allows only :alphanum:,._" character in index
This commit is contained in:
parent
1e851bd296
commit
4594e057a3
@ -11,7 +11,7 @@
|
|||||||
# This file is public domain in the USA and all free countries.
|
# This file is public domain in the USA and all free countries.
|
||||||
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
||||||
#
|
#
|
||||||
#### $$VERSION$$ v0.91-1-gdb03e23
|
#### $$VERSION$$ v0.91-2-g1e851bd
|
||||||
#
|
#
|
||||||
# Exit Codes:
|
# Exit Codes:
|
||||||
# - 0 sucess (hopefully)
|
# - 0 sucess (hopefully)
|
||||||
@ -321,7 +321,7 @@ JsonGetValue() {
|
|||||||
# $1 ARRAY name, must be declared with "declare -A ARRAY" before calling
|
# $1 ARRAY name, must be declared with "declare -A ARRAY" before calling
|
||||||
Json2Array() {
|
Json2Array() {
|
||||||
# shellcheck source=./commands.sh
|
# shellcheck source=./commands.sh
|
||||||
[ "$1" = "" ] || source <( printf "$1"'=( %s )' "$(sed -E -e 's/\t/=/g' -e 's/=(true|false)/="\1"/')" )
|
[ "$1" = "" ] || source <( printf "$1"'=( %s )' "$(sed -E -n -e '/\["[-0-9a-zA-Z_,."]+"\]\t/ s/\t/=/gp' -e 's/=(true|false)/="\1"/')" )
|
||||||
}
|
}
|
||||||
# output ARRAY as JSON.sh style data
|
# output ARRAY as JSON.sh style data
|
||||||
# $1 ARRAY name, must be declared with "declare -A ARRAY" before calling
|
# $1 ARRAY name, must be declared with "declare -A ARRAY" before calling
|
||||||
|
Loading…
Reference in New Issue
Block a user