diff --git a/inxi b/inxi index 61b7b9a..6d5df49 100755 --- a/inxi +++ b/inxi @@ -1,7 +1,7 @@ #!/bin/bash ######################################################################## #### Script Name: inxi -#### version: 0.4.14 +#### version: 0.4.15 #### Date: November 8 2008 ######################################################################## #### inxi is a fork of infobash, the original bash sys info script by locsmif @@ -1263,30 +1263,34 @@ get_hard_drive_data_advanced() IFS="," a_temp_working=( ${A_HDD_DATA[$i]} ) IFS="$ORIGINAL_IFS" + if [[ ${#a_temp_scsi[@]} > 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 + # discovered disk name AND ends with the correct identifier, sdx + # get rid of whitespace for some drive names and ids, and extra data after - in name + temp_name=$( tr ' ' '_' <<< ${a_temp_scsi[$j]} | cut -d '-' -f 1 ) - 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 - # discovered disk name AND ends with the correct identifier, sdx - temp_name=$( tr ' ' '_' <<< ${a_temp_scsi[$j]} | cut -d '-' -f 1 ) # get rid of whitespace for WDC - - sd_ls_by_id=$( ls -l /dev/disk/by-id | egrep -m1 ".*$temp_name.*${a_temp_working[0]}$" ) -# echo temp_name:$temp_name - if [[ -n $sd_ls_by_id ]];then - a_temp_working[2]=${a_temp_scsi[$j]} - if [[ -n $( grep 'usb-' <<< $sd_ls_by_id ) ]];then - a_temp_working[3]='usb' + sd_ls_by_id=$( ls -l /dev/disk/by-id | egrep -m1 ".*$temp_name.*${a_temp_working[0]}$" ) + # echo temp_name:$temp_name + if [[ -n $sd_ls_by_id ]];then + a_temp_working[2]=${a_temp_scsi[$j]} + if [[ -n $( grep 'usb-' <<< $sd_ls_by_id ) ]];then + a_temp_working[3]='usb' + fi + break + else + # special initial usb handling + # if [[ -n $( ls -l /dev/disk/by-id | egrep -m1 ".*/USB.*${a_temp_working[0]}$" ) ]];then + # + # else + a_temp_working[2]="Name n/a" + # fi fi - break - else - # special initial usb handling -# if [[ -n $( ls -l /dev/disk/by-id | egrep -m1 ".*/USB.*${a_temp_working[0]}$" ) ]];then -# -# else - a_temp_working[2]="Name n/a" -# fi - fi - done + done + else + a_temp_working[2]="Name n/a" + fi # these loops are to easily extend the cpu array created in the awk script above with more fields per cpu. for (( j=0; j < ${#a_temp_working[@]}; j++ ))