From d47c12614487898bb50f0dd917c23f9368a52ce4 Mon Sep 17 00:00:00 2001 From: Dylan Date: Fri, 29 Apr 2016 10:25:46 +1000 Subject: [PATCH] Cleaner rewrite --- neofetch | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/neofetch b/neofetch index e2403dd8..fe30d400 100755 --- a/neofetch +++ b/neofetch @@ -591,32 +591,24 @@ getuptime () { days=$((uptime / 86400)) case "$minutes" in - 1) minutes="1 minute" ;; + 1) uptime="1 minute" ;; 0) unset minutes ;; - *) minutes="$minutes minutes" ;; + *) uptime="$minutes minutes" ;; esac case "$hours" in - 1) hours="1 hour" ;; + 1) uptime="1 hour, $uptime" ;; 0) unset hours ;; - *) hours="$hours hours" ;; + *) uptime="$hours hours, $uptime" ;; esac case "$days" in - 1) days="1 day" ;; + 1) uptime="1 day, $uptime" ;; 0) unset days ;; - *) days="$days days" ;; + *) uptime="$days days, $uptime" ;; esac - [ ! -z "$hours" ] && \ - [ ! -z "$minutes" ] && \ - hours+="," - - [ ! -z "$days" ] && \ - [ ! -z "$hours" ] && \ - days+="," - - uptime="up $days $hours $minutes" + uptime="up $uptime" ;; esac