I made a script called "book" and it is the first useful bash script I have made.
This script asks you how many pages your book has, how much you've read,
and how many days you have to complete it.
It will then tell you how many pages to read a day and places a schedule in a file called book.txt.
Code:
# /bin/bash
# book bash script 0.1
# by ned
echo "Please answer the questions correctly!"
echo "I haven't put any error checking in yet!"
read -p "How many pages does the book contain? " contain
read -p "How many pages have you finished reading? " donerd
read -p "How many days (including today) do you have to read it? " days
perday=$((($contain-$donerd)/$days))
echo "You need to read $perday pages each day."
echo "The pages per day and schedule have been placed in book.txt."
{
echo "You need to read $perday pages each day."
for ((a=1; a < days ; a++))
do
onday=$((donerd += perday))
echo "On day $a, read to page $onday."
done
echo "On day $days, finish the book!"
} > book.txt
exit 0
If anyone has tips for improvement, such as better code or a new feature please post!
One of the most important things I'd like to add is error checking.