From b4f19e8a3d13f30424d45a08894e03525476102c Mon Sep 17 00:00:00 2001 From: Dylan Date: Sat, 26 Mar 2016 23:17:27 +1100 Subject: [PATCH] Cleanup CPU function --- neofetch | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/neofetch b/neofetch index 988a32a6..900e2d2f 100755 --- a/neofetch +++ b/neofetch @@ -819,11 +819,7 @@ getcpu () { case "$os" in "Linux") # Get cpu name - cpu="$(grep -F 'model name' /proc/cpuinfo)" - cpu=${cpu/model name*: } - cpu=${cpu/ @*} - cpu=${cpu// } - cpu=${cpu%% } + cpu="$(awk -F ': | @' '/model name/ {printf $2; exit}' /proc/cpuinfo)" # Get cpu speed if [ -d "/sys/devices/system/cpu/cpu0/cpufreq" ]; then @@ -841,8 +837,7 @@ getcpu () { /sys/devices/system/cpu/cpu0/cpufreq/${speed_type} else - speed=$(awk -F ': ' '/cpu MHz/ {printf $2; exit}' /proc/cpuinfo) - speed=${speed/\.} + speed=$(awk -F ': |\\.' '/cpu MHz/ {printf $2; exit}' /proc/cpuinfo) fi # Convert mhz to ghz without bc