jshn.sh: add json_get_vars() wrapper function
authorFelix Fietkau <nbd@openwrt.org>
Sun, 13 May 2012 22:21:12 +0000 (00:21 +0200)
committerFelix Fietkau <nbd@openwrt.org>
Sun, 13 May 2012 22:21:12 +0000 (00:21 +0200)
sh/jshn.sh

index d325460..117da67 100644 (file)
@@ -104,6 +104,13 @@ json_get_var() {
        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