2
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00

remove $ on regular variables in arithmetic contexts

https://github.com/koalaman/shellcheck/wiki/SC2004
This commit is contained in:
Nils 2018-02-22 12:36:25 +01:00
parent 2a84478fea
commit 15125852e8

View file

@ -119,11 +119,11 @@ if [ "$1" = "config" ]; then
nGpusCounter=0 nGpusCounter=0
while [ $nGpusCounter -lt $nGpus ] while [ $nGpusCounter -lt $nGpus ]
do do
gpuName=$(echo "$nGpusOutput" | sed -n $(( $nGpusCounter + 1 ))p | cut -d \( -f 1) gpuName=$(echo "$nGpusOutput" | sed -n $((nGpusCounter+1))p | cut -d \( -f 1)
echo "temp${nGpusCounter}.warning ${warning:-75}" echo "temp${nGpusCounter}.warning ${warning:-75}"
echo "temp${nGpusCounter}.critical ${critical:-95}" echo "temp${nGpusCounter}.critical ${critical:-95}"
echo "temp${nGpusCounter}.info Temperature information for $gpuName" echo "temp${nGpusCounter}.info Temperature information for $gpuName"
: $(( nGpusCounter = $nGpusCounter + 1 )) : $((nGpusCounter=nGpusCounter+1))
done done
;; ;;
mem) mem)
@ -133,11 +133,11 @@ if [ "$1" = "config" ]; then
nGpusCounter=0 nGpusCounter=0
while [ $nGpusCounter -lt $nGpus ] while [ $nGpusCounter -lt $nGpus ]
do do
gpuName=$(echo "$nGpusOutput" | sed -n $(( $nGpusCounter + 1 ))p | cut -d \( -f 1) gpuName=$(echo "$nGpusOutput" | sed -n $((nGpusCounter+1))p | cut -d \( -f 1)
echo "mem${nGpusCounter}.info Memory information for $gpuName" echo "mem${nGpusCounter}.info Memory information for $gpuName"
gpuMem=$(echo "$gpusTotalMemOutput"| sed -n $(( $nGpusCounter + 1 ))p) gpuMem=$(echo "$gpusTotalMemOutput"| sed -n $((nGpusCounter+1))p)
gpusTotalMem="${gpusTotalMem}${gpuMem} for GPU ${nGpusCounter}" gpusTotalMem="${gpusTotalMem}${gpuMem} for GPU ${nGpusCounter}"
: $(( nGpusCounter = $nGpusCounter + 1 )) : $((nGpusCounter=nGpusCounter+1))
if [ $nGpusCounter -lt $nGpus ]; then if [ $nGpusCounter -lt $nGpus ]; then
gpusTotalMem="${gpusTotalMem}, " gpusTotalMem="${gpusTotalMem}, "
fi fi
@ -158,9 +158,9 @@ if [ "$1" = "config" ]; then
nGpusCounter=0 nGpusCounter=0
while [ $nGpusCounter -lt $nGpus ] while [ $nGpusCounter -lt $nGpus ]
do do
gpuName=$(echo "$nGpusOutput" | sed -n $(( $nGpusCounter + 1 ))p | cut -d \( -f 1) gpuName=$(echo "$nGpusOutput" | sed -n $((nGpusCounter+1))p | cut -d \( -f 1)
echo "fan${nGpusCounter}.info Fan information for $gpuName" echo "fan${nGpusCounter}.info Fan information for $gpuName"
: $(( nGpusCounter = $nGpusCounter + 1 )) : $((nGpusCounter=nGpusCounter+1))
done done
;; ;;
power) power)
@ -171,9 +171,9 @@ if [ "$1" = "config" ]; then
nGpusCounter=0 nGpusCounter=0
while [ $nGpusCounter -lt $nGpus ] while [ $nGpusCounter -lt $nGpus ]
do do
gpuName=$(echo "$nGpusOutput" | sed -n $(( $nGpusCounter + 1 ))p | cut -d \( -f 1) gpuName=$(echo "$nGpusOutput" | sed -n $((nGpusCounter+1))p | cut -d \( -f 1)
echo "power${nGpusCounter}.info power consumption of $gpuName" echo "power${nGpusCounter}.info power consumption of $gpuName"
: $(( nGpusCounter = $nGpusCounter + 1 )) : $((nGpusCounter=nGpusCounter+1))
done done
;; ;;
*) *)
@ -187,9 +187,9 @@ if [ "$1" = "config" ]; then
nGpusCounter=0 nGpusCounter=0
while [ $nGpusCounter -lt $nGpus ] while [ $nGpusCounter -lt $nGpus ]
do do
gpuName=$(echo "$nGpusOutput" | sed -n $(( $nGpusCounter + 1 ))p | cut -d \( -f 1) gpuName=$(echo "$nGpusOutput" | sed -n $((nGpusCounter+1))p | cut -d \( -f 1)
echo "${name}${nGpusCounter}.label $gpuName" echo "${name}${nGpusCounter}.label $gpuName"
: $(( nGpusCounter = $nGpusCounter + 1 )) : $((nGpusCounter=nGpusCounter+1))
#print_warning $name #print_warning $name
#print_critical $name #print_critical $name
done done
@ -209,11 +209,11 @@ case $name in
nGpusCounter=0 nGpusCounter=0
while [ $nGpusCounter -lt $nGpus ] while [ $nGpusCounter -lt $nGpus ]
do do
totalMemGpu=$(echo "$totalMemGpus" | sed -n $(( $nGpusCounter + 1 ))p) totalMemGpu=$(echo "$totalMemGpus" | sed -n $((nGpusCounter+1))p)
usedMemGpu=$(echo "$usedMemGpus" | sed -n $(( $nGpusCounter + 1 ))p) usedMemGpu=$(echo "$usedMemGpus" | sed -n $((nGpusCounter+1))p)
percentMemUsed=$(( $usedMemGpu * 100 / $totalMemGpu )) percentMemUsed=$((usedMemGpu*100/totalMemGpu))
valueGpus="${valueGpus}${percentMemUsed}"$'\n' valueGpus="${valueGpus}${percentMemUsed}"$'\n'
: $(( nGpusCounter = $nGpusCounter + 1 )) : $((nGpusCounter=nGpusCounter+1))
done done
;; ;;
fan) fan)
@ -234,9 +234,9 @@ case $name in
nGpusCounter=0 nGpusCounter=0
while [ $nGpusCounter -lt $nGpus ] while [ $nGpusCounter -lt $nGpus ]
do do
value=$(echo "$valueGpus" | sed -n $(( $nGpusCounter + 1 ))p) value=$(echo "$valueGpus" | sed -n $((nGpusCounter+1))p)
echo "${name}${nGpusCounter}.value $value" echo "${name}${nGpusCounter}.value $value"
: $(( nGpusCounter = $nGpusCounter + 1 )) : $((nGpusCounter=nGpusCounter+1))
done done