Rewrite uptime
This commit is contained in:
parent
f1cc911e02
commit
9b6e7782dc
1 changed files with 16 additions and 11 deletions
27
neofetch
27
neofetch
|
@ -590,20 +590,25 @@ getuptime () {
|
||||||
hours=$((uptime / 3600%24))
|
hours=$((uptime / 3600%24))
|
||||||
days=$((uptime / 86400))
|
days=$((uptime / 86400))
|
||||||
|
|
||||||
days=" $days days"
|
case "$mins" in
|
||||||
hours=", $hours hours"
|
1) mins="1 minute" ;;
|
||||||
mins=", $mins minutes"
|
0) ;;
|
||||||
|
*) mins="$mins minutes" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
days=${days/ 0 days}
|
case "$hours" in
|
||||||
days=${days/, 1 days/, 1 day}
|
1) hours="1 hour" ;;
|
||||||
|
0) ;;
|
||||||
|
*) hours="$hours hours" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
hours=${hours/, 0 hours}
|
case "$days" in
|
||||||
hours=${hours/, 1 hours/, 1 hour}
|
1) days="1 day" ;;
|
||||||
|
0) ;;
|
||||||
|
*) days="$days days" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
mins=${mins/, 0 minutes}
|
uptime="up $days, $hours, $minutes"
|
||||||
mins=${mins/, 1 minutes/, 1 minute}
|
|
||||||
|
|
||||||
uptime="up ${days}${hours}${mins}"
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue