Reading 5 Students names and grades using while loop????
How do I write a shell script file to read 5 student names (First and Last name) and their grades using a While Loop? Find the Average, Maximum, and Minimum of grades using the same While Loop. Prompt the user using tput to enter the information (first name, last name, grade). Save the data in a file called students.txt. Sort the file by last name and display it on the screen. Someone gave me this to go buy but im way basic and am not sure if there is anything missing from this. I also need to be able to use Tput.
If anyone can help me get this done or tell me whats missing id appreciate it.
1. suppose file is of form "Name Surname Grade"
cat $file | while read line; do
sum='expr $sum + $grade'
if [ $grade -gt $max ]; then
if [ $grade -lt $min ]; then
i='expr $i + 1'
if [ $i -ge $n ]; then
average='expr $sum / $i'
echo "Max: $max Min: $min Avg: $average"
|Thread Tools||Search this Thread|
|More UNIX and Linux Forum Topics You Might Find Helpful|
|Thread||Thread Starter||Forum||Replies||Last Post|
|Problem with File Names under tcsh loop||InfoSeeker||Shell Programming and Scripting||4||10-22-2010 02:34 PM|
|File Names in a Variable in a loop||spkandy||Shell Programming and Scripting||3||06-11-2009 06:55 AM|
|help with a 'while read' loop to change the names of files||starsky||Shell Programming and Scripting||6||03-01-2008 01:47 PM|
|executing scripts by reading names from a file||konark||Shell Programming and Scripting||3||11-08-2007 02:28 AM|