From dc08df12ac2bb61f8fbfde95e864c28256355a8d Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Wed, 14 Dec 2016 11:45:33 +1100 Subject: [PATCH] CPU: Simplify format check --- neofetch | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/neofetch b/neofetch index 60d90d3b..e1f38a5f 100755 --- a/neofetch +++ b/neofetch @@ -862,26 +862,19 @@ get_cpu() { ;; esac - # Format the output - case "$os" in - "Mac OS X" | "iPhone OS") ;; - *) - # Fix for speeds under 1ghz - if [[ -z "${speed:1}" ]]; then - speed="0.${speed}" - else - speed="${speed:0:1}.${speed:1}" - fi + # Fix for speeds under 1ghz + if [[ "$speed" ]]; then + if [[ -z "${speed:1}" ]]; then + speed="0.${speed}" + else + speed="${speed:0:1}.${speed:1}" + fi - cpu="$cpu @ ${speed}GHz $temp" - ;; - esac + cpu="$cpu @ ${speed}GHz $temp" + fi # Remove uneeded patterns from cpu output - # This is faster than sed/gsub - cpu="${cpu//(tm)}" cpu="${cpu//(TM)}" - cpu="${cpu//(r)}" cpu="${cpu//(R)}" cpu="${cpu//CPU}" cpu="${cpu//Processor}"