#/bin/bash #score.sh #color function colour() { case $1 in black_white) echo -e "\033[40;37m" ;; black_green) echo -e "\033[40;32m" ;; black_cyan) echo -e "\033[40;36m" ;; red_yellow) echo -e "\033[41;33m" ;; yellow_blue) echo -e "\033[43;34m" ;; *)echo "invalid colour" ;; esac } #search function search() { colour black_white clear echo -e "please enter name >>>\c" read NAME #wujilu if [ ! -f ./record ];then echo"you must have some scores before you can seach!" sleep 10 clear return fi if [ -z $NAME ];then echo "you did't enter a name!" echo -e "please enter name >>>\c" read NAME fi grep -i "$NAME" ./record 2> /dev/null case $? in 1)echo "name not in record!" ;; 2)echo "you did't enter name to search!" sleep 10 search esac } #add record add() { clear echo -e "enter name and score of a record:\c" if [ ! -f ./record ];then touch record fi read NEWNAME echo "$NEWNAME">./record sort -o ./record ./record } #delete delete() { clear echo -e "please enter name >>>c" read NAME if [ ! -f ./record ];then echo "This name is not in record" else cp record record.bak rm -f record grep -v "$NAME" ./record.bak >record rm -f record.bak fi } #display record display() { colour black_white more ./record sleep 10 } #edit edit() { vi ./record } #help pingmu help() { clear colour black_cyan echo "This is a student's record program by unix shell language" } #exit quit() { clear colour black_white exit } clear while true do colour red_yellow echo "##########################################" echo "# 1:search a record #" echo "# 2:add a record #" echo "# 3:delete a record #" echo "# 4:display all record #" echo "# 5:edit record with vi #" echo "# H:help screen #" echo "# Q:exit pragma #" echo "##########################################" colour black_green echo -e -n "\tplease enter your choice [1 2 3 4 5 H Q]: \c" read CHOICE case $CHOICE in 1)search ;; 2)add; ;; 3)delete;clear ;; 4)display ;; 5)edit;clear ;; H)help ;; Q)quit ;; *)echo "please enter valid mode" ;; esac sleep 10 clear done“专业、务实、高效、创新、把客户的事当成自己的事”是我们每一个人一直以来坚持追求的企业文化。 创新互联公司是您可以信赖的网站建设服务商、专业的互联网服务提供商! 专注于网站设计制作、成都网站建设、软件开发、设计服务业务。我们始终坚持以客户需求为导向,结合用户体验与视觉传达,提供有针对性的项目解决方案,提供专业性的建议,创新互联建站将不断地超越自我,追逐市场,引领市场!
另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。