while statt for

This commit is contained in:
Michael Grote 2021-09-19 18:52:41 +02:00
parent b02b26f889
commit af9a1a3e34

View file

@ -138,12 +138,14 @@ while read -r line; do
# https://stackoverflow.com/questions/23816264/remove-all-special-characters-and-case-from-string-in-bash
# --> https://www.shell-tips.com/bash/math-arithmetic-calculation/
echo multigraph mikrotik_cpu_load_detailed_graph_$name
for c in {1..$anzahl_cpu} # range
echo $anzahl_cpu
while [ $c -lt $anzahl_cpu ]
do
echo $line | grep cpu$c | sed 's/%//g' | awk '{
print "cpu_load_detailed_graph_load" "'"cpu$c"'" $3;
print "cpu_load_detailed_graph_irq" "'"cpu$c"'" $4;
print "cpu_load_detailed_graph_disk" "'"cpu$c"'" $5}'
c=$(( $c + 1 ))
done
fi
done <<< "$data"