shellScript之嵌套if_else语句
来源:互联网 发布:淘宝网狗狗鞋子 编辑:程序博客网 时间:2024/05/17 18:18
#!/bin/bashecho "Please input a integer(0-100):"read scoreif [ "$score" -lt 0 -o "$score" -gt 100 ];thenecho "The score what you input is not integer or the score is not in(0-100)"else if [ "$score" -ge 90 ];thenecho "The grade is A!" elseif [ "$score" -ge 80 ];then echo "The grade is B!"else if [ "$score" -ge 70 ];thenecho "The grade is C!" elseif [ "$score" -ge 60 ];then echo "The grade is D!"else echo "The grade is E!"fi fi fi fifi
结果:
~/Note/test # ./2if_else.sh Please input a integer(0-100):80The grade is B!~/Note/test # ./2if_else.sh Please input a integer(0-100):20The grade is E!~/Note/test # ./2if_else.sh Please input a integer(0-100):90The grade is A!~/Note/test # ./2if_else.sh Please input a integer(0-100):70The grade is C
阅读全文
0 0
- shellScript之嵌套if_else语句
- shellScript之if_else语句
- shellScript之if_elif_else语句
- shellScript之case语句
- shellScript之for语句
- shellScript之while语句
- shellScript之while语句
- shellScript之util语句
- shellScript之continue语句
- shellScript之select语句
- shellscript之简单的if语句
- 选择条件语句if_else结构
- if_else
- shellScript之位置参数
- shellScript之break关键字
- shellScript之hello函数
- shellScript之数组操作1
- shellScript之数组操作2
- stm32f1xx i2c通讯故障可能原因
- java程序如何执行(原理)
- PAT练习-打印沙漏
- python入门系列6―——函数
- Redis GEO地理使用(六)
- shellScript之嵌套if_else语句
- 采用dlopen、dlsym、dlclose加载动态链接库【总结】
- Android studio 报错 java.util.concurrent.ExecutionException: com.android.dex.DexIndexOverflowExcep 解决方
- angularJs-The factory and service of angularJs
- 火狐Firefox浏览器 历史版本下载地址
- HTTP请求报文和HTTP响应报文
- python入门系列7―——模块
- Java机器学习库ML之七分类预测输出概率值
- ubuntu16.04下,JDK的安装,卸载和切换