mirror of
https://github.com/smxi/inxi.git
synced 2024-11-16 16:21:39 +00:00
found the bug, gawk creates an array item if you test for its presence using array[1] != "" even when it didn't exist, bad gawk, bad
This commit is contained in:
parent
0b3c6a6bdc
commit
64aa40b175
14
inxi
14
inxi
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
########################################################################
|
||||
#### Script Name: inxi
|
||||
#### version: 1.0.105-b1
|
||||
#### version: 1.0.106-b1
|
||||
#### Date: 28 July 2009
|
||||
########################################################################
|
||||
#### SPECIAL THANKS
|
||||
|
@ -3013,7 +3013,6 @@ get_sensors_data()
|
|||
eval $LOGFS
|
||||
|
||||
local sample="
|
||||
|
||||
"
|
||||
# echo "$sample"| gawk -v userCpuNo="$SENSORS_CPU_NO" '
|
||||
|
||||
|
@ -3182,13 +3181,14 @@ local sample="
|
|||
else {
|
||||
moboTempReal=temp2
|
||||
}
|
||||
|
||||
# then set the cpu fan speed
|
||||
if ( aFanReal[1] == "" ) {
|
||||
if ( tempFanType == 1 && aFanWorking[1] != "" ) {
|
||||
# note, you cannot test for aFanWorking[1] or [2] != ""
|
||||
# because that creates an array item in gawk just by the test itself
|
||||
if ( tempFanType == 1 && 1 in aFanWorking ) {
|
||||
aFanReal[1]=aFanWorking[1]
|
||||
}
|
||||
else if ( tempFanType == 2 && aFanWorking[2] != "" ) {
|
||||
else if ( tempFanType == 2 && 2 in aFanWorking ) {
|
||||
aFanReal[1]=aFanWorking[2]
|
||||
}
|
||||
}
|
||||
|
@ -3201,7 +3201,7 @@ local sample="
|
|||
if ( ! 3 in aFanReal ) {
|
||||
aFanReal[3] = ""
|
||||
}
|
||||
|
||||
|
||||
# then we need to get the actual numeric max array count for both fan arrays
|
||||
for (i = 0; i <= 14; i++) {
|
||||
if ( i in aFanReal && i > indexCountaFanReal ) {
|
||||
|
@ -3213,8 +3213,6 @@ local sample="
|
|||
indexCountaFanWorking=i
|
||||
}
|
||||
}
|
||||
print "icafw: " indexCountaFanWorking
|
||||
print "icafr: " indexCountaFanReal
|
||||
|
||||
# clear out any duplicates. Primary fan real trumps fan working always if same speed
|
||||
for (i = 1; i <= indexCountaFanReal; i++) {
|
||||
|
|
Loading…
Reference in a new issue