LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-26-2003, 09:45 AM   #1
nmsupra
LQ Newbie
 
Registered: Nov 2003
Posts: 1

Rep: Reputation: 0
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
 
Old 11-26-2003, 09:57 AM   #2
jim mcnamara
Member
 
Registered: May 2002
Posts: 964

Rep: Reputation: 36
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"
.................
 
Old 11-26-2003, 10:13 AM   #3
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
I only got it about half way done.
Then post what you've got.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Iptables (with masq) troubleshooting, very simple script attached script and logs. xinu Linux - Networking 13 11-01-2007 04:19 AM
Directory listing - Calling shell script from a CGI script seran Programming 6 08-11-2005 11:08 PM
creating shell script that executes as root regardless of who runs the script? m3kgt Linux - General 13 06-04-2004 10:23 PM
send automatic input to a script called by another script in bash programming jorgecab Programming 2 04-01-2004 12:20 AM
linux 9 and java script error - premature end of script header sibil Linux - Newbie 0 01-06-2004 04:21 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:09 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration