LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Script Help Please!!! (https://www.linuxquestions.org/questions/programming-9/script-help-please-120138/)

nmsupra 11-26-2003 09:45 AM

Script Help Please!!!
 
I only got it about half way done. I need some help to finish it.

Create a script that will allow me to enter 7 days worth of temperatures (loop 7 times). The script will then read in the daily temperatures and display a message "Comfriming that day 1 temperature is" and give the temperature. The number 1 in this statement should change for each day (ex. Day1, Day2, Day3 etc..) then ad them to get a total of all seven days. I should then get the average temperature and echo it out to screen with the messeage: "Average weekly temperature was" and then give the temperature.

thx

jim mcnamara 11-26-2003 09:57 AM

Sounds like homework.....

Here is a start, you get to finish it

Code:

#!/usr/bin/sh
let cnt=1
while [ cnt -lt 8 ]
do
    echo "enter temperature for day $cnt:\c"
    read temp$cnt
    cnt=`expr $cnt + 1`

done
cnt=1
echo "$temp1"
echo "$temp2"
.................


unSpawn 11-26-2003 10:13 AM

I only got it about half way done.
Then post what you've got.


All times are GMT -5. The time now is 05:15 PM.