Syntax Error when calculating an average
SO here is a question on my homework:
Write a program to continue taking numbers from the user until he/she enters a null value. When so, the program should show the average value. So here is the code I used Code:
1 echo "Keep entering numbers until you want to stop" |
You can use 'set -xv' at the top of your script to debug thus
Code:
#!/bin/bash Next time show the exact error msg you get. Useful links http://rute.2038bug.com/index.html.gz http://tldp.org/LDP/Bash-Beginners-G...tml/index.html http://www.tldp.org/LDP/abs/html/ |
my error message was as such:
Code:
./average: line 8: let: total=20+: syntax error: operand expected (error token is "+") |
If you add my debug suggestion, you'll see the problem/solution.
|
All times are GMT -5. The time now is 06:33 PM. |