From ec29e744066f7278973240837246620f9be70186 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Tue, 29 May 2018 08:48:03 +1000 Subject: [PATCH] cpu: Simplify cpu_cores --- neofetch | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/neofetch b/neofetch index 05faa904..24d99135 100755 --- a/neofetch +++ b/neofetch @@ -1002,9 +1002,9 @@ get_distro() { *) machine_arch="$(uname -m)" ;; esac - if [[ "$os_arch" == "on" ]]; then + + [[ "$os_arch" == "on" ]] && \ distro+=" ${machine_arch}" - fi [[ "${ascii_distro:-auto}" == "auto" ]] && \ ascii_distro="$(trim "$distro")" @@ -1793,7 +1793,7 @@ get_cpu() { # Get CPU cores. case "$cpu_cores" in "logical" | "on") cores="$(grep -c "^processor" "$cpu_file")" ;; - "physical") cores="$(grep "^core id" "$cpu_file" | sort -u | wc -l)" ;; + "physical") cores="$(awk '/^core id/&&!a[$0]++{++i}END{print i}' "$cpu_file")" ;; esac ;;