首页 > 系统服务 > 详细

简单的shell脚本

时间:2015-10-26 18:55:49      阅读:234      评论:0      收藏:0      [点我收藏+]

好久没玩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

简单的shell脚本

原文:http://hason.blog.51cto.com/8271396/1706440

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!