loadavg.5s.bash

#377
Raw
Author
Anonymous
Created
Aug. 20, 2021, 10:16 p.m.
Expires
Never
Size
223 bytes
Hits
46
Syntax
Bash
#!/usr/bin/env bash
set -eu -o pipefail

# The optional "s" in "averages" is to accommodate differences in BSD vs GNU
# uptime.
[[ $(uptime) =~ load\ averages?:\ (.*) ]]
s="${BASH_REMATCH[1]}"
echo "${s//,/}"