shell学生信息管理.docx

上传人:b****7 文档编号:9242954 上传时间:2023-02-03 格式:DOCX 页数:8 大小:14.98KB
下载 相关 举报
shell学生信息管理.docx_第1页
第1页 / 共8页
shell学生信息管理.docx_第2页
第2页 / 共8页
shell学生信息管理.docx_第3页
第3页 / 共8页
shell学生信息管理.docx_第4页
第4页 / 共8页
shell学生信息管理.docx_第5页
第5页 / 共8页
点击查看更多>>
下载资源
资源描述

shell学生信息管理.docx

《shell学生信息管理.docx》由会员分享,可在线阅读,更多相关《shell学生信息管理.docx(8页珍藏版)》请在冰豆网上搜索。

shell学生信息管理.docx

shell学生信息管理

insert_s()

{

file_name="/root/aillo/students.db"

dialog--title"Student:

Insertarecord"--inputbox"Pleaseinputthestudent'sinformationinthesort:

(id,name,college):

"20502>tmp.txt

content=$(cattmp.txt)

IFS=","

readsidsnamesin

unsetIFS

grep-c"$sid"$file_name>menu.txt

sid=$(catmenu.txt)

if["$sid"!

="0"];then

dialog--title"ERROR"--msgbox"Recordhasexisted!

"2030

else

echo"$content">>$file_name

dialog--title"ReplyInfo"--msgbox"Addsuccessfully!

"1030

fi

}

insert_c()

{

file_name="/root/aillo/colleges.db"

dialog--title"College:

Insertarecord"--inputbox"Pleaseinputthecollege'sinformationinthesort(cid,cname):

"20502>tmp.txt

content=$(cattmp.txt)

IFS=","

readcidcname

unsetIFS

grep-c"$cid"$file_name>tmp.txt

cid=$(cattmp.txt)

if["$cid"!

="0"];then

dialog--title"ERROR"--msgbox"Recordhasexisted!

"3050

else

echo"$content">>$file_name

dialog--title"ReplyInfo"--msgbox"Addsuccessfully!

"1030

fi

}

delete_s()

{file_name="/root/aillo/students.db"

dialog--title"Student:

Deletearecord"--inputbox"PleaseinputtheIDofthestudentyouwanttodelete:

"20502>tmp.txt

readsid

grep-v$sid$file_name>tmp.txt

mvtmp.txt$file_name

dialog--title"ReplyInfo"--msgbox"therecordhasbeendelete!

"1030

}

delete_c()

{file_name="/root/aillo/colleges.db"

dialog--title"College:

Deletearecord"--inputbox"PleaseinputtheIDofthecollegeyouwanttodelete:

"20502>tmp.txt

readcid

grep-v$cid$file_name>tmp.txt

mvtmp.txt$file_name

dialog--title"ReplyInfo"--msgbox"therecordhasbeendelete!

"1030

}

display_s()

{file_name="/root/aillo/students.db"

cat$file_name|whilereadline

do

echo$line>tmp.txt

IFS=","

readsidsnamesin

echo"sid:

$sid">>t.txt

echo"sname:

$sname">>t.txt

echo"sin:

$sin">>t.txt

echo"---------------------">>t.txt

IFS=""

done

content=$(catt.txt)

dialog--title"AllStudents'Info"--msgbox"$content"5050

rmt.txt

}

display_c()

{file_name="/root/aillo/colleges.db"

cat$file_name|whilereadline

do

echo$line>tmp.txt

IFS=","

readcidcname

echo"cid:

$cid">>t.txt

echo"cname:

$cname">>t.txt

echo"---------------------">>t.txt

IFS=""

done

content=$(catt.txt)

dialog--title"Allcolleges'Info"--msgbox"$content"5050

rmt.txt

}

count()

{

file_name="/root/aillo/students.db"

dialog--title"Count"--inputbox"Pleaseinputtheidofcollegestudentsyouwanttocount:

"20502>tmp.txt

readp1

dialog--title"ReplyInfo"--msgbox"Thereare`grep-c$p1$file_name`studentsinthe$p1college!

"1030

}

change_s()

{

file_name="/root/aillo/students.db"

dialog--title"ModifyStudent'sInfo"--inputbox"Pleaseinputthenewinformationyouwanttomodifyinthesort(sid,sname,sin):

"20502>tmp.txt

IFS=","

readp1p2p3

grep-v$p1$file_name>tmp.txt

echo"$p1,$p2,$p3">>tmp.txt

IFS=""

mvtmp.txt$file_name

dialog--title"ReplyInfo"--msgbox"Theinformationhasbeenmodified!

"1030

}

change_c()

{

file_name="/root/aillo/colleges.db"

dialog--title"ModifyCollege'sInfo"--inputbox"Pleaseinputthenewinformation:

"20502>tmp.txt

IFS=","

readp1p2

grep-v$p1$file_name>tmp.txt

echo"$p1,$p2">>tmp.txt

IFS=""

mvtmp.txt$file_name

dialog--title"ReplyInfo"--msgbox"Theinformationhasbeenmodified!

"1030

}

status=1

dialog--title"Students'InfoManageSystem"--msgbox"\\nWelccometousetheSystem!

\\n"1035

if[$?

!

=0];then

sleep1

dialog--clear

exit0

fi

while["$status"="1"]

do

dialog--title"MainMenu"--menu"Choices"152021"Student"2"College"2>tmp.txt

MY_CHOICE=$(cattmp.txt)

if[$?

!

=0];then

sleep1

dialog--clear

exit0

fi

if["$MY_CHOICE"="1"];then

dialog--title"StudentInfoManage"--menu"ChooseOperation"203071"INSERT"2"DELETE"3"MODIFY"4"COUNT"5"DISPLAY"6"BACK"7"EXIT"2>tmp.txt

if[$?

!

=0];then

sleep1

dialog--clear

exit0

fi

choice_2=$(cattmp.txt)

if["$choice_2"="1"];then

insert_s

elif["$choice_2"="2"];then

delete_s

elif["$choice_2"="3"];then

change_s

elif["$choice_2"="4"];then

count

elif["$choice_2"="5"];then

display_s

elif["$choice_2"="6"];then

continue

else

break

fi

else

dialog--title"CollegeInfoManage"--menu"ChooseOperation"203071"INSERT"2"DELETE"3"MODIFY"4"COUNT"5"DISPLAY"6"BACK"7"EXIT"2>tmp.txt

if[$?

!

=0];then

sleep1

dialog--clear

exit0

fi

choice_2=$(cattmp.txt)

if["$choice_2"="1"];then

insert_c

elif["$choice_2"="2"];then

delete_c

elif["$choice_2"="3"];then

change_c

elif["$choice_2"="4"];then

count

elif["$choice_2"="5"];then

display_c

elif["$choice_2"="6"];then

continue

else

break

fi

fi

dialog--yesno"Doyouwanttocontinue?

"1020

if[$?

=0];then

status=1

else

status=0

fi

done

sleep1

dialog--clear

exit0

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > PPT模板 > 简洁抽象

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1