Skip to content

Instantly share code, notes, and snippets.

@srathbone
Created March 16, 2020 09:59
Show Gist options
  • Select an option

  • Save srathbone/31b737f275c186f82259bfdbf749d3d3 to your computer and use it in GitHub Desktop.

Select an option

Save srathbone/31b737f275c186f82259bfdbf749d3d3 to your computer and use it in GitHub Desktop.
uptime.sh
#!/bin/bash
main() {
local uptime
uptime="$(cat /proc/uptime)"
uptime="${uptime%%.*}"
local minutes
minutes="$(( uptime / 60 ))"
printf "%d:%d\n" "$(( minutes / 60 ))" "$(( minutes % 60 ))"
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment