Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.openwrt.org/project/libubox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/sh
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2012-12-16 21:04:14 +0400
committerFelix Fietkau <nbd@openwrt.org>2012-12-16 21:04:14 +0400
commit7bca5dd29dd39bf3a5ad3005dc408ac81bcb727b (patch)
tree84ae22292edec4e9e7be8ee3aa3a832e7266c5b1 /sh
parente16fa068a57318fff073da4a0f8f0535a97fe208 (diff)
jshn: fix some variable handling regressions
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Diffstat (limited to 'sh')
-rw-r--r--sh/jshn.sh10
1 files changed, 7 insertions, 3 deletions
diff --git a/sh/jshn.sh b/sh/jshn.sh
index 242e5a4..4600c52 100644
--- a/sh/jshn.sh
+++ b/sh/jshn.sh
@@ -113,7 +113,7 @@ _json_close_table() {
local stack new_stack
_json_get_var stack JSON_STACK
- _json_set_var cur "${JSON_STACK##* }"
+ _json_set_var JSON_CUR "${stack##* }"
new_stack="${stack% *}"
[[ "$stack" == "$new_stack" ]] && new_stack=
_json_set_var JSON_STACK "$new_stack"
@@ -219,19 +219,23 @@ json_get_vars() {
json_select() {
local target="$1"
local type
+ local cur
[ -z "$1" ] && {
_json_set_var JSON_CUR "JSON_VAR"
return 0
}
[[ "$1" == ".." ]] && {
- eval "JSON_CUR=\"\${UP_$JSON_CUR}\""
+ _json_get_var cur JSON_CUR
+ _json_get_var cur "UP_$cur"
+ _json_set_var JSON_CUR "$cur"
return 0
}
json_get_type type "$target"
case "$type" in
object|array)
- _json_get_var JSON_CUR "$target"
+ json_get_var cur "$target"
+ _json_set_var JSON_CUR "$cur"
;;
*)
echo "WARNING: Variable '$target' does not exist or is not an array/object"