From a2712b6333078ec335ada8df1dcade205db578b9 Mon Sep 17 00:00:00 2001 From: Dylan Date: Fri, 29 Apr 2016 09:52:47 +1000 Subject: [PATCH] New uptime formatting --- neofetch | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/neofetch b/neofetch index c7540a53..d95393e8 100755 --- a/neofetch +++ b/neofetch @@ -594,26 +594,11 @@ getuptime () { echo "$hours" echo "$days" - # Format the output like Linux's "uptime -p" cmd. - if [ "$mins" == 1 ]; then - uptime="$mins minute" - elif [ "$mins" != 0 ]; then - uptime="$mins minutes" - fi + days="$days days," + hours="$hours hours," + mins="$mins minutes" - if [ "$hours" == 1 ]; then - uptime="$hours hour, $uptime" - elif [ "$mins" != 0 ]; then - uptime="$hours hours, $uptime" - fi - - if [ "$days" == 1 ]; then - uptime="$days day, $uptime" - elif [ "$days" != 0 ]; then - uptime="$days days, $uptime" - fi - - uptime="up $uptime" + uptime="up ${days/0 days,} ${hours/ 0 hours,} ${mins/0 mins}" ;; esac