Added null data handler for temp array scsi

This commit is contained in:
inxi-svn 2008-11-08 22:26:16 +00:00
parent 0b4058277c
commit 0a6347bed9

10
inxi
View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
######################################################################## ########################################################################
#### Script Name: inxi #### Script Name: inxi
#### version: 0.4.14 #### version: 0.4.15
#### Date: November 8 2008 #### Date: November 8 2008
######################################################################## ########################################################################
#### inxi is a fork of infobash, the original bash sys info script by locsmif #### inxi is a fork of infobash, the original bash sys info script by locsmif
@ -1263,12 +1263,13 @@ get_hard_drive_data_advanced()
IFS="," IFS=","
a_temp_working=( ${A_HDD_DATA[$i]} ) a_temp_working=( ${A_HDD_DATA[$i]} )
IFS="$ORIGINAL_IFS" IFS="$ORIGINAL_IFS"
if [[ ${#a_temp_scsi[@]} > 0 ]];then
for (( j=0; j < ${#a_temp_scsi[@]}; j++ )) for (( j=0; j < ${#a_temp_scsi[@]}; j++ ))
do do
## ok, ok, it's incomprehensible, search /dev/disk/by-id for a line that contains the ## 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 # 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 # 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 )
sd_ls_by_id=$( ls -l /dev/disk/by-id | egrep -m1 ".*$temp_name.*${a_temp_working[0]}$" ) sd_ls_by_id=$( ls -l /dev/disk/by-id | egrep -m1 ".*$temp_name.*${a_temp_working[0]}$" )
# echo temp_name:$temp_name # echo temp_name:$temp_name
@ -1287,6 +1288,9 @@ get_hard_drive_data_advanced()
# fi # fi
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. # 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++ )) for (( j=0; j < ${#a_temp_working[@]}; j++ ))