Simplify uptime for OSX / BSD

This commit is contained in:
Dylan 2016-03-26 10:04:23 +11:00
parent 36ca05dba5
commit eefca64248

View file

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