From 2b72944289385acb22d150d91c69f4abc91da9b5 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Thu, 12 May 2016 20:34:36 +1000 Subject: [PATCH] Fix CPU speed on BSD --- neofetch | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/neofetch b/neofetch index 08a2abb7..20fe84ac 100755 --- a/neofetch +++ b/neofetch @@ -1104,10 +1104,18 @@ getcpu () { # Get cpu cores cores=$(sysctl -n hw.ncpu) + # Fix for speeds under 1ghz + if [ -z "${speed:1}" ]; then + speed="0.${speed}" + else + speed=${speed:0:1}.${speed:1} + fi + cpu="$cpu @ ${speed}GHz" ;; esac + # Remove uneeded patterns from cpu output # This is faster than sed/gsub cpu=${cpu//(tm)}