Cleanup CPU function
This commit is contained in:
parent
95c744f0f8
commit
b4f19e8a3d
1 changed files with 2 additions and 7 deletions
9
neofetch
9
neofetch
|
@ -819,11 +819,7 @@ getcpu () {
|
||||||
case "$os" in
|
case "$os" in
|
||||||
"Linux")
|
"Linux")
|
||||||
# Get cpu name
|
# Get cpu name
|
||||||
cpu="$(grep -F 'model name' /proc/cpuinfo)"
|
cpu="$(awk -F ': | @' '/model name/ {printf $2; exit}' /proc/cpuinfo)"
|
||||||
cpu=${cpu/model name*: }
|
|
||||||
cpu=${cpu/ @*}
|
|
||||||
cpu=${cpu// }
|
|
||||||
cpu=${cpu%% }
|
|
||||||
|
|
||||||
# Get cpu speed
|
# Get cpu speed
|
||||||
if [ -d "/sys/devices/system/cpu/cpu0/cpufreq" ]; then
|
if [ -d "/sys/devices/system/cpu/cpu0/cpufreq" ]; then
|
||||||
|
@ -841,8 +837,7 @@ getcpu () {
|
||||||
/sys/devices/system/cpu/cpu0/cpufreq/${speed_type}
|
/sys/devices/system/cpu/cpu0/cpufreq/${speed_type}
|
||||||
|
|
||||||
else
|
else
|
||||||
speed=$(awk -F ': ' '/cpu MHz/ {printf $2; exit}' /proc/cpuinfo)
|
speed=$(awk -F ': |\\.' '/cpu MHz/ {printf $2; exit}' /proc/cpuinfo)
|
||||||
speed=${speed/\.}
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Convert mhz to ghz without bc
|
# Convert mhz to ghz without bc
|
||||||
|
|
Loading…
Reference in a new issue