From 21c82ea77a7ab6ed9862eef7c604988995015cb5 Mon Sep 17 00:00:00 2001 From: David Runge Date: Mon, 23 Apr 2018 08:41:33 +0200 Subject: bin/get_load: Make script support macOS (needs different output parsing). --- bin/get_load | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bin/get_load b/bin/get_load index f409630..705c655 100755 --- a/bin/get_load +++ b/bin/get_load @@ -1,8 +1,13 @@ #!/usr/bin/env bash set -euo pipefail IFS=$'\n\t' +uptime_output="" -uptime_output=$(uptime| cut -d',' -f4,5,6|cut -d':' -f2) +if [ "$(uname)" == "Darwin" ]; then + uptime_output=$(uptime| cut -d',' -f3| cut -d':' -f2) +else + uptime_output=$(uptime| cut -d',' -f4,5,6|cut -d':' -f2) +fi uptime_output=${uptime_output#" "} echo "$uptime_output" -- cgit v1.2.3-70-g09d2