From bb95137f01514d2b6a93dbffdbe4a5f52ccb8fa0 Mon Sep 17 00:00:00 2001 From: Andrew Titmuss Date: Sat, 19 Mar 2016 13:32:33 +1100 Subject: [PATCH] changed case to if, shaves 0.1 seconds from run time --- neofetch | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/neofetch b/neofetch index cfaea51b..4e1aa4fa 100755 --- a/neofetch +++ b/neofetch @@ -589,23 +589,23 @@ getuptime () { days=$((uptime / 86400)) # Format the output like Linux's "uptime -p" cmd. - case "$mins" in - 0) ;; - 1) uptime="up $mins minute" ;; - *) uptime="up $mins minutes" ;; - esac + if [ "$mins" == 1 ]; then + uptime="up $mins minute" + elif [ "$mins" != 0 ]; then + uptime="up $mins minutes" + fi - case "$hours" in - 0) ;; - 1) uptime="up $hours hour, ${uptime/up }" ;; - *) uptime="up $hours hours, ${uptime/up }" ;; - esac + if [ "$hours" == 1 ]; then + uptime="up $hours hour, ${uptime/up }" + elif [ "$mins" != 0 ]; then + uptime="up $hours hours, ${uptime/up }" + fi - case "$days" in - 0) ;; - 1) uptime="up $days day, ${uptime/up }" ;; - *) uptime="up $days days, ${uptime/up }" ;; - esac + if [ "$days" == 1 ]; then + uptime="up $days day, ${uptime/up }" + elif [ "$days" != 0 ]; then + uptime="up $days days, ${uptime/ up}" + fi ;; "Windows")