I need the EXACT same output as Linux's "cat /proc/uptime".
For example, with /proc/uptime, you'd get
1884371.64 38646169.12
but with any Mac alternative, like "uptime", you'd get
20:25 up 20:26, 6 users, load averages: 3.19 2.82 2.76
I need it to be exactly like cat /proc/uptime, but on Mac OS X.
while IFS=' =', read -d ',' key value; do eval "boot_time_$key='$value'" 2>/dev/null; done <<< $(sysctl -n kern.boottime | sed 's/^.*{//;s/}.*$/,/')
, you can then simply pull the value you need fromboot_time_sec
, and can convert it with something likedate -jf '%s' "$boot_time_sec"
– Mokas