#ex.
while true
do
clear
tput cup 2 28
echo "Student Information"
tput cup 3 24
echo "***********************"
tput cup 4 24
echo "1,insert information"
tput cup 5 24
echo "2,select information"
tput cup 6 24
echo "3,delect information"
tput cup 7 24
echo "0,exit"
tput cup 8 24
echo "***********************"
tput cup 9 24
echo -n "please type in the option:"
read AA
case $AA in
1)tput cup 10 24
echo -n "SID:"
read A
tput cup 11 24
echo -n "Name:"
read B
tput cup 12 24
echo -n "Address:"
read C
tput cup 13 24
echo -n "Course:"
read D
tput cup 14 24
echo -n "insert the record[y/n]?"
read YY
case $YY in
y)echo $A:$B:$C:$D >>list
tput cup 15 24
echo -n "insert ok"
;;
n)tput cup 15 24
echo -n "error,please retry!"
;;
esac
;;
2)tput cup 10 24
echo -n "please type in the SID:"
read BB
if grep ^${BB}: list >/dev/null 2>&1
then
tput cup 11 24
grep ^${BB}: list
else
tput cup 11 24
echo -n "Not Found!"
fi
;;
3)tput cup 10 24
echo -n "please type in the SID:"
read CC
tput cup 11 24
echo -n "delete the record[y/n]"
read NN
case $NN in
y)grep -v $CC list >list.tmp
cat list.tmp >list
tput cup 12 24
echo -n "delete ok"
;;
n)tput cup 12 24
echo -n "delete fail!"
;;
*)tput cup 12 24
echo -n "errorr,please retry!"
;;
esac
;;
0)exit
;;
*)tput cup 10 24
echo -n "error,please retry!"
;;
esac
read FFF
done