Unverified Commit b83a48a6 authored by Michael Straube's avatar Michael Straube Committed by GitHub

uptime: Fix shorthand off (#1564)

parent f74746d5
...@@ -1433,7 +1433,7 @@ get_uptime() { ...@@ -1433,7 +1433,7 @@ get_uptime() {
d="$((s / 60 / 60 / 24)) days" d="$((s / 60 / 60 / 24)) days"
h="$((s / 60 / 60 % 24)) hours" h="$((s / 60 / 60 % 24)) hours"
m="$((s / 60 % 60)) mins" m="$((s / 60 % 60)) minutes"
# Remove plural if < 2. # Remove plural if < 2.
((${d/ *} == 1)) && d=${d/s} ((${d/ *} == 1)) && d=${d/s}
...@@ -1447,20 +1447,24 @@ get_uptime() { ...@@ -1447,20 +1447,24 @@ get_uptime() {
uptime=${d:+$d, }${h:+$h, }$m uptime=${d:+$d, }${h:+$h, }$m
uptime=${uptime%', '} uptime=${uptime%', '}
uptime=${uptime:-$s secs} uptime=${uptime:-$s seconds}
# Make the output of uptime smaller. # Make the output of uptime smaller.
case $uptime_shorthand in case $uptime_shorthand in
on) ;; on)
uptime=${uptime/ minutes/ mins}
uptime=${uptime/ minute/ min}
uptime=${uptime/ seconds/ secs}
;;
tiny) tiny)
uptime=${uptime/ days/d} uptime=${uptime/ days/d}
uptime=${uptime/ day/d} uptime=${uptime/ day/d}
uptime=${uptime/ hours/h} uptime=${uptime/ hours/h}
uptime=${uptime/ hour/h} uptime=${uptime/ hour/h}
uptime=${uptime/ mins/m} uptime=${uptime/ minutes/m}
uptime=${uptime/ min/m} uptime=${uptime/ minute/m}
uptime=${uptime/ secs/s} uptime=${uptime/ seconds/s}
uptime=${uptime//,} uptime=${uptime//,}
;; ;;
esac esac
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment