I essentially want to calculate this:
"calculate how much beer an 18+ user has drunk statistically (100 liters/year) and print this information for the user."
Not sure how to calculate it i.e. use a loop or other to use the difference in specified age versus user input age, multiply the result, I made an attempt in the last section of code.
# This script check's the user's age and if they can legally drink alcohol
echo "What age are you?"
years=$[$age - $uage]
beer=$[$years ge $lage]
if [ "$uage" -ge "$age" ] ; then
echo -e "You are $uage and are of legal age to drink alcohol\n" &&
echo -e "You have drank $ litres of beer since you turned 18 years of age."
echo -e "You are $uage and are not of legal age to drink alcohol\n" &&
echo -e "You have to wait $years years before you can legally drink alcohol"
while [$beer]; do
echo " "
let $beer = $beer+1 * 100
if [ "$uage" == "$lage" ] ; then
echo " You have drank $beer litres of beer since you were born"
echo "You have not drank much beer"