From 289b99d40169d0e07b9e5588c5674ac3e7512010 Mon Sep 17 00:00:00 2001 From: "K.Cima" Date: Mon, 28 Nov 2016 23:55:30 +0900 Subject: [PATCH] Add comments for evals --- plugins/oracle/oracle_sysstat_ | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/plugins/oracle/oracle_sysstat_ b/plugins/oracle/oracle_sysstat_ index d2a2afc7..b6c6897a 100755 --- a/plugins/oracle/oracle_sysstat_ +++ b/plugins/oracle/oracle_sysstat_ @@ -495,7 +495,9 @@ config() { local line t fields field type draw label while IFS= read -r line do - eval 't=(' "$line" ')' + # split line into field,type,draw,label + # eval looks necessary to preserve whitespaces + eval "t=( ${line} )" field="${t[0]}" [ -z "$field" ] && continue fields+=( $field ) @@ -511,13 +513,19 @@ config() { echo graph_order "${fields[@]}" } +# wrapper for getfield_* getfield() { if [ -n "${getfield_func[$module]:-}" ]; then + # call getfield_* function with args if necessary + # eval looks necessary if args contain whitespaces eval "${getfield_func[$module]}" fi } +# wrapper for getvalue_* getvalue() { + # call getvalue_* function with args if necessary + # eval looks necessary if args contain whitespaces eval "${getvalue_func[$module]}" } @@ -525,7 +533,9 @@ getvalue_sysstat() { local line t field label while IFS= read -r line do - eval 't=(' "$line" ')' + # split line into field,type,draw,label + # eval looks necessary to preserve whitespaces + eval "t=( ${line} )" field="${t[0]}" [ -z "$field" ] && continue label="${t[3]}" @@ -550,7 +560,9 @@ getvalue_sgainfo() { local line t field label while IFS= read -r line do - eval 't=(' "$line" ')' + # split line into field,type,draw,label + # eval looks necessary to preserve whitespaces + eval "t=( ${line} )" field="${t[0]}" [ -z "$field" ] && continue label="${t[3]}" @@ -575,7 +587,9 @@ getvalue_pgastat() { local line t field label while IFS= read -r line do - eval 't=(' "$line" ')' + # split line into field,type,draw,label + # eval looks necessary to preserve whitespaces + eval "t=( ${line} )" field="${t[0]}" [ -z "$field" ] && continue label="${t[3]}"