docs: update
This commit is contained in:
parent
eb7d543fd8
commit
d6bf31f5e7
5
pfetch
5
pfetch
|
@ -38,16 +38,21 @@ get_kernel() {
|
||||||
}
|
}
|
||||||
|
|
||||||
get_uptime() {
|
get_uptime() {
|
||||||
|
# Uptime works by retrieving the data in total seconds and then
|
||||||
|
# converting that data into days, hours and minutes using simple
|
||||||
|
# math.
|
||||||
case $os in
|
case $os in
|
||||||
linux)
|
linux)
|
||||||
IFS=. read -r s _ < /proc/uptime
|
IFS=. read -r s _ < /proc/uptime
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
# Convert the uptime from seconds into days, hours and minutes.
|
||||||
d=$((s / 60 / 60 / 24))
|
d=$((s / 60 / 60 / 24))
|
||||||
h=$((s / 60 / 60 % 24))
|
h=$((s / 60 / 60 % 24))
|
||||||
m=$((s / 60 % 60))
|
m=$((s / 60 % 60))
|
||||||
|
|
||||||
|
# Only append days, hours and minutes if they're non-zero.
|
||||||
[ "$d" = 0 ] || uptime="${uptime}${d}d "
|
[ "$d" = 0 ] || uptime="${uptime}${d}d "
|
||||||
[ "$h" = 0 ] || uptime="${uptime}${h}h "
|
[ "$h" = 0 ] || uptime="${uptime}${h}h "
|
||||||
[ "$m" = 0 ] || uptime="${uptime}${m}m "
|
[ "$m" = 0 ] || uptime="${uptime}${m}m "
|
||||||
|
|
Loading…
Reference in New Issue
Block a user