Skip to content

Why did you use BC? #89

@diasdmhub

Description

@diasdmhub

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions