Write a script for generating a mark sheet after reading data from a file. File contains student roll no, name , marks of three subjects.

cat marksheet

 

echo -e “Enter the roll number::\c”

read rno

 

rno=expr $rno + 1

lable=head -1 marksheet

row=head -$rno marksheet|tail -1

 

m1=head -$rno marksheet|tail -1|cut -f3

m2=head -$rno marksheet|tail -1|cut -f4

m3=head -$rno marksheet|tail -1|cut -f5

 

echo $lable Total Per

 

sum=expr $m1 + $m2 + $m3

 

per=expr $sum / 3

 

echo $row $sum $per

if [ $m1 -le 35 -o $m2 -le 35 -o $m3 -le 35 ]

then

echo “Sorry you are fail”

else

if [ $per -le 35 ]

then

echo Pass Class

elif [ $per -le 50 ]

then

echo Second class

elif [ $per -le 60 ]

then

echo First Class

else

echo Distiction

 

fi

fi

 

OUTPUT::

 

Enter the roll number::2

rno name m1 m2 m3 Total Per

2 geeta  78 67 90 235 78

Distiction

 

Share

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.