Logo 
Search:

Unix / Linux / Ubuntu Forum

Ask Question   UnAnswered
Home » Forum » Unix / Linux / Ubuntu       RSS Feeds

Shell Script writting

  Asked By: Tsega    Date: Jan 21    Category: Unix / Linux / Ubuntu    Views: 1888
  

I was trying to write in a shell script a student grade? I reached over here, Please help me if any one knows???
echo “Enter the number of students:”
read n

echo “Enter roll no.:”
read rollno
echo “Enter name:”
read name
echo “Entermark-1? 
read m1
echo "Entermark-2:"
read m2
echo "Entermark-3:"
read m3

tot='expr $m1 + $m2 + $m3'

//echo "Sum of 3 mark are: " $tot
avg='expr $tot / 3'
echo Average=$avg
if [ $avg -ge 75 ] then
grade="Distinction"
elif [ $avg -ge 60 ]
then
grade="First class"
elif [ $avg -ge 50 ]
then
grade="Second class"
else
grade="Fail"
fi

Thanks a lot!!!

Share: 

 

No Answers Found. Be the First, To Post Answer.

 
Didn't find what you were looking for? Find more on Shell Script writting Or get search suggestion and latest updates.




Tagged: