Explorar o código

fixed json output

Serghey Rodin %!s(int64=14) %!d(string=hai) anos
pai
achega
bb37747065
Modificáronse 1 ficheiros con 7 adicións e 1 borrados
  1. 7 1
      func/ip_func.sh

+ 7 - 1
func/ip_func.sh

@@ -475,6 +475,12 @@ ip_user_json_list() {
             # Print data
             for field in $fields; do
                 eval value=$field
+
+                # There is outpup
+                if [ ! -z "$value" ]; then
+                    tpt='yes'
+                fi
+
                 # Checking parrent key
                 if [ "$j" -eq 1 ]; then
                     echo -e "\t\"$value\": {"
@@ -492,7 +498,7 @@ ip_user_json_list() {
     done
 
     # If there was any output
-    if [ -n "$value" ]; then
+    if [ -n "$tpt" ]; then
         echo -e "\t}"
     fi