updated uptime script to be fluent and replaced keybinds
parent
034943ef7e
commit
24eee5670a
@ -1,4 +1,16 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
uptime=$(cat /proc/uptime | awk '{print $1 / 60; print $1 % 60}' | xargs printf '%d min %d sec' 2>/dev/null)
|
||||
echo "$uptime"
|
||||
ft_seconds=$(cat /proc/uptime | awk '{print $1}' | xargs printf '%d' 2>/dev/null) # floored int total
|
||||
ft_minutes=$(($ft_seconds/60))
|
||||
ft_hours=$(($ft_minutes/60))
|
||||
|
||||
echo $ft_hours $ft_minutes $ft_seconds
|
||||
if [[ $ft_hours -gt 1 ]] ; then
|
||||
# display with leading hours
|
||||
rem_mins=$(($ft_minutes % 60)) # get remaining mins
|
||||
printf '%dH %dM' $ft_hours $rem_mins
|
||||
else
|
||||
# display with leading minutes
|
||||
rem_secs=$(($ft_seconds % 60)) # get remaining mins
|
||||
printf '%dM %dS' $ft_minutes $rem_secs
|
||||
fi
|
||||
|
Loading…
Reference in New Issue