Guest_imported
New member
- Jan 1, 1970
- 0
Write a bash script named addem that reads a list of numbers (on seperate lines) until teh number 999 is read, and then prints the total of all the numbers added up. It must contain the while loop and exit when the number 999 has been entered. Here is what i have. What do i need to do to this.
echo "Enter a number (999 to quit) "
read $n
while $n -ne 999
$sum += $n;
echo "enter another number (999 to quit) "
echo "The sum is $sum"
exit
done
echo "Enter a number (999 to quit) "
read $n
while $n -ne 999
$sum += $n;
echo "enter another number (999 to quit) "
echo "The sum is $sum"
exit
done