I'm wrote a simple script that converts the users weight on earth to weight on the moon. However at the end of the program I am trying to ask the user if they want to repeat the process and read their response.
If the user responds in the affirmative the script should repeat, otherwise the script should exit.
This is what I have so far, however I can't figure out how to get the script to repeat if the user decides not to quit.
echo -n "Enter starting weight: "
read star
echo -n "Enter ending weight: "
read end
echo -n "Enter weight increment: "
read increment
while [ $star -le $end ]
do
moonweight=`echo $star \* .166 | bc`
echo "$star pounds on earth = $moonweight pounds on the moon"
star=`expr $star + $increment`
done
notDone=true
while [ $notDone ]
do
echo -n "Enter a number or Q to quit: "
read var1 junk
var1=`echo $var1 | tr 'A-Z' 'a-z'`
if [ $var1 = "q" ]
then
echo "Goodbye"
exit
else
fi
done