gpu: Correctly filter out duplicates

This commit is contained in:
Dylan Araps 2017-08-01 21:25:07 +10:00
parent eb62c843c9
commit e7168245e1

View file

@ -1113,7 +1113,9 @@ get_gpu() {
"Linux")
# Read GPUs into array.
IFS=$'\n'
gpus=($(lspci -mm | awk -F '\\"|\\" \\"|\\(' '/"Display|"3D|"VGA/ {print $3 " " $4}' | uniq))
gpus=($(lspci -mm | awk -F '\\"|\\" \\"|\\(' \
'/"Display|"3D|"VGA/ {a[$0] = $3 " " $4} END{for(i in a)
{if(!seen[a[i]]++) print a[i]}}'))
IFS="$old_ifs"
# Number the GPUs if more than one exists.