diff options
| author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-08-14 12:50:14 +0200 | 
|---|---|---|
| committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-08-14 12:50:14 +0200 | 
| commit | 0b8685b836fb3cc034857438bf87076fa39af1a1 (patch) | |
| tree | 826b3dad0cd5d50ffd2f8111bc94b7ecf8ae82f5 | |
| parent | 1176f4b9ad4ba51b33f66ce2b3fe7db7c61a0382 (diff) | |
[saf] remove bc dependency
| -rwxr-xr-x | bin/common/saf | 9 | 
1 files changed, 5 insertions, 4 deletions
diff --git a/bin/common/saf b/bin/common/saf index 9e31c68..2936346 100755 --- a/bin/common/saf +++ b/bin/common/saf @@ -8,10 +8,11 @@ reset="$(printf '\033[0m')"  load ()  { -	for time in $(uptime | cut -f3- -d',' | cut -f2 -d':' | tr ',' ' ') -	do -		percent="$(echo "$time*100/$(nproc)" | bc)" -		echo "${percent:-0}%" +	# 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  }  | 
