From 811fa21a9df0c136cafab935b6882b7541a22203 Mon Sep 17 00:00:00 2001 From: David Runge Date: Fri, 11 Mar 2016 10:42:47 +0100 Subject: bin/get_*: Adding helper scripts to be used in tmux. --- bin/get_cpu_status | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100755 bin/get_cpu_status (limited to 'bin/get_cpu_status') diff --git a/bin/get_cpu_status b/bin/get_cpu_status new file mode 100755 index 0000000..2aece18 --- /dev/null +++ b/bin/get_cpu_status @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +set -euo pipefail +IFS=$'\n\t' + +proc_output="" + +proc_output=$(grep 'cpu ' /proc/stat | awk '{usage=($2+$4)*100/($2+$4+$5)} END {printf("%5.1f", usage)}') +proc_output=${proc_output#" "} + +echo "$proc_output%" -- cgit v1.2.3-70-g09d2