Merge pull request #164 from iandrewt/osx_uptime

changed osx_uptime parsing of seconds from case to if
This commit is contained in:
Dylan Araps 2016-03-19 16:31:25 +11:00
commit 60ce0d14e5
1 changed files with 15 additions and 15 deletions

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