From f6eb8916c118cc4bdf22cab4127864ecf8728d80 Mon Sep 17 00:00:00 2001 From: Thomas Debesse Date: Sat, 9 Apr 2016 00:51:30 +0200 Subject: call lspci once --- sysinfo.sh | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/sysinfo.sh b/sysinfo.sh index 2a0df4a..796922d 100755 --- a/sysinfo.sh +++ b/sysinfo.sh @@ -48,10 +48,7 @@ disk_free=`echo $sua | awk '{printf "%d",$4/1048576;}'`; #---[ VGA ] --------------------------- gpu='' if which lspci >/dev/null 2>/dev/null; then - gpu_slot=`lspci -mm | grep 'VGA' | head -n 1 | cut -f1 -d' '` - gpu_vendor=`lspci -s "${gpu_slot}" -mm -v | grep '^Vendor' | sed -e 's/Vendor:\t//' | sed -e 's/.*[ ]\[//;s/\].*//' | sed -e 's/, Inc.//;s/ Corporation//;s/ Co.//;s/,Ltd.//'` - gpu_model=`lspci -s "${gpu_slot}" -mm -v | grep '^Device' | sed -e 's/Device:\t//' | sed -e 's/.*[ ]\[//;s/\].*//'` - gpu="${gpu_vendor} ${gpu_model}" + gpu="`lspci -mm -v | grep -m 1 -A 2 VGA | tail -n +2 | sed -e 's/Vendor:\t//;s/Device:\t//' | sed -e 's/.*[ ]\[//;s/\].*//' | sed -e 's/, Inc.//;s/ Corporation//;s/ Co.//;s/,Ltd.//' | tr '\n' ' ' | sed -e 's/ $//'`" fi #---[ OUTPUT ]------------------------ -- cgit v1.2.3