Fixed whitespace issue and name issue with OS X uptime

This commit is contained in:
dylan araps 2016-01-04 15:50:52 +11:00
parent 62db9ad83a
commit b0e9cc4782
2 changed files with 24 additions and 5 deletions

View file

@ -162,3 +162,12 @@ Here's what's on my todo list
#### Fill
![fill](https://imgur.com/LvxYwki.png)
### Thanks
Thanks to:
- Screenfetch: I've used some snippets as a base for a few functions in this script
- @jrgz: Helping me test the Mac OS X version.

View file

@ -267,13 +267,23 @@ getuptime () {
hours=$((${uptime}/3600%24))
days=$((${uptime}/86400))
uptime="up ${mins} minutes"
case "$mins" in
0) ;;
1) uptime="up ${mins} minute" ;;
*) uptime="up ${mins} minutes" ;;
esac
[ "${hours}" -ne 0 ] && \
uptime="up ${hours} hours, ${uptime/up/}"
case "$hours" in
0) ;;
1) uptime="up ${hours} hour, ${uptime/up /}" ;;
*) uptime="up ${hours} hours, ${uptime/up /}" ;;
esac
[ "${days}" -ne 0 ] && \
uptime="up ${days} days, ${uptime/up/}"
case "$days" in
0) ;;
1) uptime="up ${days} day, ${uptime/up /}" ;;
*) uptime="up ${days} days, ${uptime/up /}" ;;
esac
;;
"OpenBSD")