From 588dcac4345f1b728172bb00d078beba1a69c984 Mon Sep 17 00:00:00 2001 From: inxi-svn Date: Tue, 4 Aug 2009 00:12:26 +0000 Subject: [PATCH] (change version) By suggestion, now show no sensors output if error condition: missing sensors app OR no sensors output This can be overridden for debugging by override with -! 1 flag, testing 1 --- inxi | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/inxi b/inxi index a679b9a..af2aa51 100755 --- a/inxi +++ b/inxi @@ -1,8 +1,8 @@ #!/bin/bash ######################################################################## #### Script Name: inxi -#### version: 1.1.8 -#### Date: August 2 2009 +#### version: 1.1.9 +#### Date: August 3 2009 ######################################################################## #### SPECIAL THANKS ######################################################################## @@ -4253,7 +4253,7 @@ print_sensors_data() # always has at least 3 items, cpu/mobo/psu temp in it. If it's a single item, then # it's an error message, not the real data arrays. if [[ ${#a_sensors_working[@]} -eq 1 ]];then - cpu_temp=${A_SENSORS_DATA[0]} + cpu_temp="${C1}Error:${C2} ${A_SENSORS_DATA[0]}" b_is_error='true' else for (( i=0; i < ${#A_SENSORS_DATA[@]}; i++ )) @@ -4352,18 +4352,21 @@ print_sensors_data() esac done fi - temp_data="$cpu_temp$mobo_temp$psu_temp$gpu_temp" - temp_data=$( create_print_line "Sensors:" "$temp_data" ) - print_screen_output "$temp_data" - # don't print second or subsequent lines if error data - fan_data="$cpu_fan$mobo_fan$ps_fan$sys_fans" - if [[ $b_is_error != 'true' && -n $fan_data ]];then - fan_data=$( create_print_line " " "$fan_data" ) - print_screen_output "$fan_data" - # and then second wrapped fan line if needed - if [[ -n $sys_fans2 ]];then - fan_data2=$( create_print_line " " "$sys_fans2" ) - print_screen_output "$fan_data2" + # turning off all output for case where no sensors detected or no sensors output + if [[ $b_is_error != 'true' || $B_TESTING_1 == 'true' ]];then + temp_data="$cpu_temp$mobo_temp$psu_temp$gpu_temp" + temp_data=$( create_print_line "Sensors:" "$temp_data" ) + print_screen_output "$temp_data" + # don't print second or subsequent lines if error data + fan_data="$cpu_fan$mobo_fan$ps_fan$sys_fans" + if [[ $b_is_error != 'true' && -n $fan_data ]];then + fan_data=$( create_print_line " " "$fan_data" ) + print_screen_output "$fan_data" + # and then second wrapped fan line if needed + if [[ -n $sys_fans2 ]];then + fan_data2=$( create_print_line " " "$sys_fans2" ) + print_screen_output "$fan_data2" + fi fi fi eval $LOGFE