X-Git-Url: http://git.archive.openwrt.org/?p=project%2Flibubox.git;a=blobdiff_plain;f=sh%2Fjshn.sh;h=117da67b8b2e6722143a7641df1d20b582226a9b;hp=8ecefcf03f932fadb5a699b2bd9f3bd29664ddca;hb=97ed91fa77e3e2926bab3e70955a0e2b511db86e;hpb=a1a97eb11e89c420b84a659a88a4e72c7f04367d diff --git a/sh/jshn.sh b/sh/jshn.sh index 8ecefcf..117da67 100644 --- a/sh/jshn.sh +++ b/sh/jshn.sh @@ -100,10 +100,17 @@ json_get_type() { json_get_var() { local dest="$1" - local var="$2" + local var="$(echo -n "$2" | tr -C '[a-zA-Z_]' _)" eval "export -- \"$dest=\${${JSON_CUR}_$var}\"" } +json_get_vars() { + while [ "$#" -gt 0 ]; do + local _var="$1"; shift + json_get_var "$_var" "$_var" + done +} + json_select() { local target="$1" local type