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.
Code:
#!/bin/bash
# This script check's the user's age and if they can legally drink alcohol
age=16
lage=18
echo "What age are you?"
read uage
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."
exit 1
else
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"
fi
while [$beer]; do
echo " "
let $beer = $beer+1 * 100
done
if [ "$uage" == "$lage" ] ; then
echo " You have drank $beer litres of beer since you were born"
else
echo "You have not drank much beer"
fi