From 248d8680f71928f3a4d374a1c16f7d5adadcff20 Mon Sep 17 00:00:00 2001 From: Promofaux Date: Thu, 12 Jan 2017 21:51:10 +0000 Subject: [PATCH] actual codacy complaints --- advanced/Scripts/chronometer.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/advanced/Scripts/chronometer.sh b/advanced/Scripts/chronometer.sh index dac7a6b7..484bbd72 100755 --- a/advanced/Scripts/chronometer.sh +++ b/advanced/Scripts/chronometer.sh @@ -19,18 +19,18 @@ gravity="/etc/pihole/gravity.list" # Borrowed/modified from https://gist.github.com/cjus/1047794 function GetJSONValue { - retVal=`echo $1 | sed 's/\\\\\//\//g' | \ + retVal=$(echo $1 | sed 's/\\\\\//\//g' | \ sed 's/[{}]//g' | \ awk -v k="text" '{n=split($0,a,","); for (i=1; i<=n; i++) print a[i]}' | \ sed 's/\"\:\"/\|/g' | \ sed 's/[\,]/ /g' | \ sed 's/\"//g' | \ - grep -w $2` + grep -w $2) echo ${retVal##*|} } outputJSON() { - json=`curl -s -X GET http://127.0.0.1/admin/api.php?summaryRaw` + json=$(curl -s -X GET http://127.0.0.1/admin/api.php?summaryRaw) echo ${json} } @@ -53,11 +53,11 @@ normalChrono() { #tail -f /var/log/pihole.log | awk '/\/etc\/pihole\/gravity.list/ {if ($7 != "address" && $7 != "name" && $7 != "/etc/pihole/gravity.list") print $7; else;}' json=`curl -s -X GET http://127.0.0.1/admin/api.php?summaryRaw` - LC_NUMERIC=C LC_COLLATE=C - domains=$(printf "%'.f" `GetJSONValue ${json} "domains_being_blocked"`) #add commas in - queries=$(printf "%'.f" `GetJSONValue ${json} "dns_queries_today"`) - blocked=$(printf "%'.f" `GetJSONValue ${json} "ads_blocked_today"`) - percentage=$(printf "%0.2f\n" `GetJSONValue ${json} "ads_percentage_today"`) #2 decimal places + + domains=$(printf "%'.f" $(GetJSONValue ${json} "domains_being_blocked")) #add commas in + queries=$(printf "%'.f" $(GetJSONValue ${json} "dns_queries_today")) + blocked=$(printf "%'.f" $(GetJSONValue ${json} "ads_blocked_today")) + percentage=$(printf "%0.2f\n" $(GetJSONValue ${json} "ads_percentage_today")) #2 decimal places echo "Blocking: ${domains}" echo "Queries: ${queries}"