Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why did you use BC? #89

Open
diasdmhub opened this issue Apr 17, 2024 · 0 comments
Open

Why did you use BC? #89

diasdmhub opened this issue Apr 17, 2024 · 0 comments

Comments

@diasdmhub
Copy link

diasdmhub commented Apr 17, 2024

I've removed the bc and command dependencies and changed the average calculation to pure shell scripting in the hopes of making the script a bit more compatible with limited systems.

Instead of

command -v (...)
(...)
avg=`bc -l <<< "scale=2; $ftime/$totaldomains"`

I changed to

which (...)
(...)
avg=$((100 * ftime / totaldomains))
avg_decimal=$((avg / 100))
avg_remainder=$((avg % 100))
printf "%d.%02d\n" $avg_decimal $avg_remainder

It seems the result is correct.

Why did you use BC after all?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant