Simplify uptime for OSX / BSD

This commit is contained in:
Dylan 2016-03-26 10:04:23 +11:00
parent 36ca05dba5
commit eefca64248
1 changed files with 8 additions and 6 deletions

View File

@ -587,22 +587,24 @@ getuptime () {
# Format the output like Linux's "uptime -p" cmd.
if [ "$mins" == 1 ]; then
uptime="up $mins minute"
mins+=" minute"
elif [ "$mins" != 0 ]; then
uptime="up $mins minutes"
mins+=" minutes"
fi
if [ "$hours" == 1 ]; then
uptime="up $hours hour, ${uptime/up }"
hours+=" hour,"
elif [ "$mins" != 0 ]; then
uptime="up $hours hours, ${uptime/up }"
hours+=" hours,"
fi
if [ "$days" == 1 ]; then
uptime="up $days day, ${uptime/up }"
days+=" day,"
elif [ "$days" != 0 ]; then
uptime="up $days days, ${uptime/ up}"
days+=" days,"
fi
uptime="up $days $hours $mins"
;;
"Windows")