好久没玩shell了,但是现实中又不能不用,下面通过简单的shell脚本来计算成绩,好了,贴代码
#!/bin/bash cat << EOF ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | Welcome to Results test shell | | | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ EOF read -p "Please put your Chinese Results : " x read -p "Please put your Mathematics Results : " y read -p "Please put your English Results : " z sum=$[$x+$y+$z] echo "This is your total Results:$sum" ##上面代码只是计算x,y,z的变量求和。好了,继续## if (($sum < 230));then echo "You didn‘t passed the exam,please hardly in the next time." else echo "Greate,you passed the exam." fi ########上面的if语句就是判断$sum求和值的大小,然后输出###########
本文出自 “小海” 博客,请务必保留此出处http://hason.blog.51cto.com/8271396/1706440
原文:http://hason.blog.51cto.com/8271396/1706440