So here's what I'm doing and what I'm trying to do:
Using bash I have a variable that counts up a total number of items. Lets call it $TOTAL
I also many variables for different days of the week and other variables:
All of the variables are integers.
The integers will change frequently and this script will need to work to evenly distribute the $TOTAL integer across the other variables to keep them as even as possible.
So lets say for example:
$TOTAL=20 # This isn't how it is actually determined just for example purposes
So in the above example, I have 20 to distribute and I want to try and keep it as even as possible. So my result would be:
$100WED=24 # Add 5 Here
$100THUR=24 # Add 5 Here
$100SAT=24 # Add 8 here
$102SAT=23 # Add 2 here
It does not have to be an exact science but due to the amount these numbers fluctuate it could be that $100SUN has 30 this week and 20 next week so I need to be able to identify the lowest variables and add them out to keep it well balanced.
I'm just trying to figure out the best way to skin the cat here as I'm not the best math person.