Update power.inc.sh
This commit is contained in:
@@ -6,7 +6,7 @@ AVERAGEPOWER(){
|
||||
total_amp=0
|
||||
total_watt=0
|
||||
while IFS=$'\t' read date amp watt ;do
|
||||
if [ "${amp}" != "" ] && [ "${watt}" != "" ]; then
|
||||
if [[ "${amp}" =~ ^[0-9]+$ ]] && [[ "${watt}" =~ ^[0-9]+$ ]]; then
|
||||
total_amp=$(bc <<< "scale=2; ${total_amp}+${amp}")
|
||||
total_watt=$(bc <<< "scale=2; ${total_watt}+${watt}")
|
||||
((logsfound++))
|
||||
@@ -24,7 +24,7 @@ AVERAGEPOWER(){
|
||||
total=0
|
||||
[ "${3}" != "" ] && ptype=${3} || ptype=watt
|
||||
while IFS=$'\t' read date ${ptype} ;do
|
||||
if [ "${!ptype}" != "" ]; then
|
||||
if [[[ "${!ptype}" =~ ^[0-9]+$ ]]; then
|
||||
total=$(bc <<< "scale=2; ${total}+${!ptype}")
|
||||
((logsfound++))
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user