changed case to if, shaves 0.1 seconds from run time

This commit is contained in:
Andrew Titmuss 2016-03-19 13:32:33 +11:00
parent 438a3a2978
commit bb95137f01

View file

@ -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")