From 6d8ce49b50362257a0a08befcf6252c57142fdae Mon Sep 17 00:00:00 2001 From: inxi-svn Date: Tue, 28 Jul 2009 20:42:20 +0000 Subject: [PATCH] fine tuned wrapping output --- inxi | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/inxi b/inxi index 63d35e5..a88d5cc 100755 --- a/inxi +++ b/inxi @@ -1,7 +1,7 @@ #!/bin/bash ######################################################################## #### Script Name: inxi -#### version: 1.0.104-b1 +#### version: 1.0.105-b1 #### Date: 28 July 2009 ######################################################################## #### SPECIAL THANKS @@ -4114,8 +4114,8 @@ print_partition_data() print_sensors_data() { eval $LOGFS - local mobo_temp='' cpu_temp='' cpu_fan='' mobo_fan='' ps_fan='' sys_fans='' - local temp_data='' fan_data='' b_is_error='false' + local mobo_temp='' cpu_temp='' cpu_fan='' mobo_fan='' ps_fan='' sys_fans='' sys_fans2='' + local temp_data='' fan_data='' fan_data2='' b_is_error='false' fan_count=0 get_sensors_data # initial error cases, for missing app or unconfigured sensors @@ -4152,29 +4152,32 @@ print_sensors_data() cpu_fan='N/A' fi cpu_fan="${C1}Fan Speeds (in rpm): cpu:${C2} $cpu_fan " + (( fan_count++ )) ;; 3) if [[ -n ${A_SENSORS_DATA[3]} ]];then mobo_fan="${C1}mobo:${C2} ${A_SENSORS_DATA[3]} " + (( fan_count++ )) fi ;; 4) if [[ -n ${A_SENSORS_DATA[4]} ]];then ps_fan="${C1}ps:${C2} ${A_SENSORS_DATA[4]} " + (( fan_count++ )) fi ;; [5-9]|10|11|12|13|14) if [[ -n ${A_SENSORS_DATA[$i]} ]];then fan_number=$(( $i - 4 )) # sys fans start on array key 5 - sys_fans="$sys_fans${C1}sys-$fan_number:${C2} ${A_SENSORS_DATA[$i]} " + # wrap after fan 6 total + if [[ $fan_count -lt 7 ]];then + sys_fans="$sys_fans${C1}sys-$fan_number:${C2} ${A_SENSORS_DATA[$i]} " + else + sys_fans2="$sys_fans2${C1}sys-$fan_number:${C2} ${A_SENSORS_DATA[$i]} " + fi + (( fan_count++ )) fi ;; - -# # then set the sys fans, if present or 0. sys fan 1 only if cpu fan is present, -# # otherwise fan1: is cpu fan -# if [[ -n ${A_SENSORS_DATA[2]} && -n ${A_SENSORS_DATA[3]} ]];then -# sys_fan1="${C1}sys-1:${C2} ${A_SENSORS_DATA[3]} " -# fi esac done fi @@ -4186,6 +4189,11 @@ print_sensors_data() fan_data="$cpu_fan$mobo_fan$ps_fan$sys_fans" 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 eval $LOGFE }