Skip to content

Commit

Permalink
fix cpu speed duplicate with intel cpu; clean intel gpu output
Browse files Browse the repository at this point in the history
  • Loading branch information
wick3dr0se committed Nov 22, 2021
1 parent 5e7e379 commit 0da184b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions fetch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,14 @@ fi


# // CPU // try cpu model from lscpu if not found /proc/cpuinfo
vendor=$(cat /proc/cpuinfo | grep -m1 "vendor_id" | sed 's/vendor_id//' | tr -d '\t :')
echo -ne "${RED}cpu${NC} ~ "
if [[ $(command -v lscpu) ]] ; then
lscpu | grep 'Model name' | sed 's/Model name://;s/Processor//;s/(TM)//;s/(R)//;s/@//;s/CPU//;s/^ *//' | tr -d '\n'
elif [ $vendor = GenuineIntel ] ; then
awk -F: '/model name/{print $2 ; exit}' /proc/cpuinfo | sed 's/Processor//;s/(TM)//;s/(R)//;s/@//;s/CPU//;s/^ *//;s/....$//' | tr -d '\n'
else
awk -F: '/model name/{print $2 ; exit}' /proc/cpuinfo | sed 's/Processor//;s/(TM)//;s/(R)//;s/@//;s/CPU//;s/^ *//' | tr -d '\n'
awk -F: '/model name/{print $2 ; exit}' /proc/cpuinfo | sed 's/Processor//;s/CPU//;s/^ *//' | tr -d '\n'
fi


Expand All @@ -83,7 +86,7 @@ fi
# // GPU // with lscpi
if [[ $(command -v lspci) ]] ; then
echo -ne "${PURPLE}gpu${NC} ~ "
lspci | grep -i --color 'vga\|3d\|2d' | sed 's/VGA compatible controller//;s/Advanced Micro Devices, Inc//;s/NVIDIA Corporation//;s/Corporation//;s/Controller//;s/Family//;s/Processor//;s/Generation/Gen/g' | tr -d '.:[]' | sed 's/^.....//;s/^ *//'
lspci | grep -i --color 'vga\|3d\|2d' | sed 's/VGA compatible controller//;s/Advanced Micro Devices, Inc//;s/NVIDIA Corporation//;s/Corporation//;s/Controller//;s/Family//;s/Processor//;s/Mixture//;s/Model//;s/Generation/Gen/g' | tr -d '.:[]' | sed 's/^.....//;s/^ *//'
else
echo -e '\n'
fi
Expand Down

0 comments on commit 0da184b

Please sign in to comment.