From eacce05f3aa95d99b50821ca435eaa57373cae01 Mon Sep 17 00:00:00 2001 From: Dylan Date: Sun, 27 Mar 2016 11:59:01 +1100 Subject: [PATCH] Fixed broken CPU speed on linux when /sys/ wasn't available --- neofetch | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/neofetch b/neofetch index 8c8072cc..7c681907 100755 --- a/neofetch +++ b/neofetch @@ -826,12 +826,11 @@ getcpu () { read -r speed < \ /sys/devices/system/cpu/cpu0/cpufreq/${speed_type} + speed=$((speed / 100000)) else speed=$(awk -F ': |\\.' '/cpu MHz/ {printf $2; exit}' /proc/cpuinfo) + speed=$((speed / 100)) fi - - # Convert mhz to ghz without bc - speed=$((speed / 100000)) speed=${speed:0:1}.${speed:1} cpu="$cpu @ ${speed}GHz" @@ -903,7 +902,7 @@ getcpu () { # Add cpu cores to output [ "$cpu_cores" == "on" ] && [ ! -z "$cores" ] && \ - cpu=${cpu/ @/ \(${cores}\) @} + cpu=${cpu/@/\(${cores}\) @} # Make the output of cpu shorter case "$cpu_shorthand" in