diff --git a/inxi b/inxi index 8678bb1..10971bf 100755 --- a/inxi +++ b/inxi @@ -1,8 +1,8 @@ #!/bin/bash ######################################################################## #### Script Name: inxi -#### version: 0.8.3 -#### Date: December 3 2008 +#### version: 0.8.4 +#### Date: December 4 2008 ######################################################################## #### inxi is a fork of infobash 3.02, the original bash sys info script by locsmif #### As time permits functionality improvements and recoding will occur. @@ -2626,14 +2626,17 @@ print_networking_ip_data() print_partition_data() { - local a_partition_working='' partition_used='' swap='' partition_data='' partition_data_2='' - local partition_data_3='' partition_data_4='' partition_data_5='' partition_data_6='' - local partition_data_7='' partition_data_8='' partition_data_9='' counter=1 line_max=160 + local a_partition_working='' partition_used='' swap='' partition_data='' + local counter=0 line_max=160 i=0 a_partition_data='' line_starter='' # this handles the different, shorter, irc colors strings embedded in variable data if [[ $B_RUNNING_IN_SHELL != 'true' ]];then line_max=130 fi + # and no color string data at all + if [[ $SCHEME -eq 0 ]];then + line_max=75 + fi # set A_PARTITION_DATA get_partition_data @@ -2656,98 +2659,23 @@ print_partition_data() swap='' fi # because these lines can vary widely, using dynamic length handling here - case $counter in - 1) - partition_data="$partition_data${C1}ID:${C2}$swap${a_partition_working[0]} ${C1}size:${C2} ${a_partition_working[1]}$partition_used " - if [[ $( wc -c <<< $partition_data ) -gt $line_max ]];then - counter=2 - fi - ;; - 2) - partition_data_2="$partition_data_2${C1}ID:${C2}$swap${a_partition_working[0]} ${C1}size:${C2} ${a_partition_working[1]}$partition_used " - if [[ $( wc -c <<< $partition_data_2 ) -gt $line_max ]];then - counter=3 - fi - ;; - 3) - partition_data_3="$partition_data_3${C1}ID:${C2}$swap${a_partition_working[0]} ${C1}size:${C2} ${a_partition_working[1]}$partition_used " - if [[ $( wc -c <<< $partition_data_3 ) -gt $line_max ]];then - counter=4 - fi - ;; - 4) - partition_data_4="$partition_data_4${C1}ID:${C2}$swap${a_partition_working[0]} ${C1}size:${C2} ${a_partition_working[1]}$partition_used " - if [[ $( wc -c <<< $partition_data_4 ) -gt $line_max ]];then - counter=5 - fi - ;; - 5) - partition_data_5="$partition_data_5${C1}ID:${C2}$swap${a_partition_working[0]} ${C1}size:${C2} ${a_partition_working[1]}$partition_used " - if [[ $( wc -c <<< $partition_data_5 ) -gt $line_max ]];then - counter=6 - fi - ;; - 6) - partition_data_6="$partition_data_6${C1}ID:${C2}$swap${a_partition_working[0]} ${C1}size:${C2} ${a_partition_working[1]}$partition_used " - if [[ $( wc -c <<< $partition_data_6 ) -gt $line_max ]];then - counter=7 - fi - ;; - 7) - partition_data_7="$partition_data_7${C1}ID:${C2}$swap${a_partition_working[0]} ${C1}size:${C2} ${a_partition_working[1]}$partition_used " - if [[ $( wc -c <<< $partition_data_7 ) -gt $line_max ]];then - counter=8 - fi - ;; - 8) - partition_data_8="$partition_data_8${C1}ID:${C2}$swap${a_partition_working[0]} ${C1}size:${C2} ${a_partition_working[1]}$partition_used " - if [[ $( wc -c <<< $partition_data_8 ) -gt $line_max ]];then - counter=9 - fi - ;; - *) - partition_data_9="$partition_data_9${C1}ID:${C2}$swap${a_partition_working[0]} ${C1}size:${C2} ${a_partition_working[1]}$partition_used " - ;; - esac + a_partition_data[$counter]="${a_partition_data[$counter]}${C1}ID:${C2}$swap${a_partition_working[0]} ${C1}size:${C2} ${a_partition_working[1]}$partition_used " + if [[ $( wc -c <<< ${a_partition_data[$counter]} ) -gt $line_max ]];then + ((counter++)) + fi fi done - # create the first line - partition_data=$( create_print_line "Partition:" "$partition_data" ) - print_screen_output "$partition_data" - - # then the rest, if required - if [[ -n $partition_data_2 ]];then - partition_data_2=$( create_print_line " " "$partition_data_2" ) - print_screen_output "$partition_data_2" - fi - if [[ -n $partition_data_3 ]];then - partition_data_3=$( create_print_line " " "$partition_data_3" ) - print_screen_output "$partition_data_3" - fi - if [[ -n $partition_data_4 ]];then - partition_data_4=$( create_print_line " " "$partition_data_4" ) - print_screen_output "$partition_data_4" - fi - if [[ -n $partition_data_5 ]];then - partition_data_5=$( create_print_line " " "$partition_data_5" ) - print_screen_output "$partition_data_5" - fi - if [[ -n $partition_data_6 ]];then - partition_data_6=$( create_print_line " " "$partition_data_6" ) - print_screen_output "$partition_data_6" - fi - if [[ -n $partition_data_7 ]];then - partition_data_7=$( create_print_line " " "$partition_data_7" ) - print_screen_output "$partition_data_7" - fi - if [[ -n $partition_data_8 ]];then - partition_data_8=$( create_print_line " " "$partition_data_8" ) - print_screen_output "$partition_data_8" - fi - if [[ -n $partition_data_9 ]];then - partition_data_9=$( create_print_line " " "$partition_data_9" ) - print_screen_output "$partition_data_9" - fi + # print out all lines, line starter on first line + for (( i=0; i < ${#a_partition_data[@]};i++ )) + do + if [[ $i -eq 0 ]];then + line_starter='Partition:' + else + line_starter=' ' + fi + partition_data=$( create_print_line "$line_starter" "${a_partition_data[$i]}" ) + print_screen_output "$partition_data" + done } print_system_data()