diff options
author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-08-22 23:08:50 +0200 |
---|---|---|
committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-08-22 23:08:50 +0200 |
commit | 067b271a243dafcf652fe7cfe85e723d25ff1a64 (patch) | |
tree | c546402b2c40ca1e0739d1cc404f1d04d1d45067 /bin/common/saf | |
parent | 67a2df82d25f52ea0937f4eed355546deae7b4b5 (diff) | |
parent | 9172676556847ff625cbf4b4eff19f441e0b9386 (diff) |
Merge branch 'main' of /var/git/dotfiles
Diffstat (limited to 'bin/common/saf')
-rwxr-xr-x | bin/common/saf | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/bin/common/saf b/bin/common/saf index 0c6fbc4..2936346 100755 --- a/bin/common/saf +++ b/bin/common/saf @@ -3,10 +3,19 @@ # Simple Ass Fetch by futxlii red="$(printf '\033[31m')" -green="$(printf '\033[32m')" blue="$(printf '\033[34m')" reset="$(printf '\033[0m')" +load () +{ + # take everything after 'load average: ' then remove '0.' or '.' or ',' + # from output, this multiplies by hundred, so we can divide an integer + # instead of a fraction (which dash can't do) + for time in $(uptime | sed -e 's/^.*load average://' -e 's/0\?\.\|,//g') + do printf "%s%%\n" "$((time/$(nproc)))" + done | xargs +} + for file in /etc/os-release /usr/lib/os-release do [ -f "$file" ] && . "$file" && break @@ -19,6 +28,6 @@ SHELL="$(basename "$SHELL")" cat <<EOF ${red}- ${blue}${ID:-"unknown"} ${red}- ${blue}$KERNEL - ${red}- ${blue}$UPTIME + ${red}- ${blue}$UPTIME ($(load)) ${red}- ${blue}$SHELL${reset} EOF |