From 3a91faffee13036756318778e03c199d3652e028 Mon Sep 17 00:00:00 2001 From: inxi-svn Date: Fri, 7 Aug 2009 00:51:10 +0000 Subject: [PATCH] logic cleanup in printout function for hdd data --- inxi | 39 ++++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/inxi b/inxi index ec7f3ca..f857208 100755 --- a/inxi +++ b/inxi @@ -1,7 +1,7 @@ #!/bin/bash ######################################################################## #### Script Name: inxi -#### version: 1.1.12 +#### version: 1.1.13 #### Date: August 6 2009 ######################################################################## #### SPECIAL THANKS @@ -3945,7 +3945,7 @@ print_hard_disk_data() local hdd_capacity=${a_hdd_basic_working[0]} local hdd_used=${a_hdd_basic_working[1]} - if [[ $VERBOSITY_LEVEL -ge 3 ]] || [[ $B_SHOW_DISK == 'true' ]];then + if [[ $VERBOSITY_LEVEL -ge 3 || $B_SHOW_DISK == 'true' ]];then ## note: the output part of this should be in the print hdd data function, not here get_hard_drive_data_advanced for (( i=0; i < ${#A_HDD_DATA[@]} - 1; i++ )) @@ -3974,27 +3974,24 @@ print_hard_disk_data() divisor=2 # for modulus line print out, either 2 items for full, or default for short fi hdd_name="${a_hdd_working[2]}" - - if [[ $B_SHOW_DISK == 'true' || $VERBOSITY_LEVEL -ge 3 ]];then - hdd_string="$usb_data$dev_data$hdd_name$size_data$hdd_temp_data" - hdd_model="${hdd_model}${C1}$(($i+1)):${C2} $hdd_string " - # printing line one, then new lines according to $divisor setting, and after, if leftovers, print that line. - case $i in - 0) - hdd_data=$( create_print_line "Disks:" "${C1}HDD${C2} ${C1}Total Size:${C2} ${hdd_capacity} (${hdd_used}) ${hdd_model}" ) + hdd_string="$usb_data$dev_data$hdd_name$size_data$hdd_temp_data" + hdd_model="${hdd_model}${C1}$(($i+1)):${C2} $hdd_string " + # printing line one, then new lines according to $divisor setting, and after, if leftovers, print that line. + case $i in + 0) + hdd_data=$( create_print_line "Disks:" "${C1}HDD${C2} ${C1}Total Size:${C2} ${hdd_capacity} (${hdd_used}) ${hdd_model}" ) + print_screen_output "$hdd_data" + hdd_model='' + ;; + *) + # using modulus here, if divisible by $divisor, print line, otherwise skip + if [[ $(( $i % $divisor )) -eq 0 ]];then + hdd_data=$( create_print_line " " "${hdd_model}${CN}" ) print_screen_output "$hdd_data" hdd_model='' - ;; - *) - # using modulus here, if divisible by $divisor, print line, otherwise skip - if [[ $(( $i % $divisor )) -eq 0 ]];then - hdd_data=$( create_print_line " " "${hdd_model}${CN}" ) - print_screen_output "$hdd_data" - hdd_model='' - fi - ;; - esac - fi + fi + ;; + esac done # then print any leftover items if [[ -n $hdd_model ]];then