diff --git a/inxi b/inxi index bee7eb5..dcd0a28 100755 --- a/inxi +++ b/inxi @@ -884,7 +884,7 @@ get_start_client() # Since Konversation 1.0, the DCOP interface has changed a bit: dcop "$DCPORT" Konversation ..etc # becomes : dcop "$DCPORT" default ... or dcop "$DCPORT" irc ..etc. So we check for versions smaller # than 1 and change the DCOP parameter/object accordingly. - if [[ ${T2} < 1 ]];then + if [[ ${T2} -lt 1 ]];then DCOPOBJ="Konversation" fi IRC_CLIENT="Konversation" @@ -1708,7 +1708,7 @@ get_hard_drive_data_advanced() IFS="," a_temp_working=( ${A_HDD_DATA[$i]} ) IFS="$ORIGINAL_IFS" - if [[ ${#a_temp_scsi[@]} > 0 ]];then + if [[ ${#a_temp_scsi[@]} -gt 0 ]];then for (( j=0; j < ${#a_temp_scsi[@]}; j++ )) do ## ok, ok, it's incomprehensible, search /dev/disk/by-id for a line that contains the @@ -2620,7 +2620,7 @@ 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='' counter=0 + local partition_data_3='' partition_data_4='' partition_data_5='' counter=1 line_max=150 # set A_PARTITION_DATA get_partition_data @@ -2642,19 +2642,38 @@ print_partition_data() else swap='' fi - if [[ $counter -lt 3 ]];then - partition_data="$partition_data${C1}ID:${C2}$swap${a_partition_working[0]} ${C1}size:${C2} ${a_partition_working[1]}$partition_used " - elif [[ $counter -lt 6 ]];then - partition_data_2="$partition_data_2${C1}ID:${C2}$swap${a_partition_working[0]} ${C1}size:${C2} ${a_partition_working[1]}$partition_used " - elif [[ $counter -lt 9 ]];then - partition_data_3="$partition_data_3${C1}ID:${C2}$swap${a_partition_working[0]} ${C1}size:${C2} ${a_partition_working[1]}$partition_used " - elif [[ $counter -lt 12 ]];then - partition_data_4="$partition_data_4${C1}ID:${C2}$swap${a_partition_working[0]} ${C1}size:${C2} ${a_partition_working[1]}$partition_used " - else - partition_data_5="$partition_data_5${C1}ID:${C2}$swap${a_partition_working[0]} ${C1}size:${C2} ${a_partition_working[1]}$partition_used " - fi - # we can't use the $i counter here because it doesn't always increment - ((counter++)) + # 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 " +# echo 1 $( wc -c <<< $partition_data ) + 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 " +# echo 2 $( wc -c <<< $partition_data_2 ) + 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 + ;; + *) + partition_data_5="$partition_data_5${C1}ID:${C2}$swap${a_partition_working[0]} ${C1}size:${C2} ${a_partition_working[1]}$partition_used " + ;; + esac fi done partition_data=$( create_print_line "Partition:" "$partition_data" )