shellScript之util语句
来源:互联网 发布:淘宝上的dota2 编辑:程序博客网 时间:2024/06/05 03:36
#!/bin/bashi=0until [[ "$i" -gt 5 ]]do let "square=i*i" echo "$i * $i = $square" let "i++"done
结果:
~/Note/test # ./15until.sh 0 * 0 = 01 * 1 = 12 * 2 = 43 * 3 = 94 * 4 = 165 * 5 = 25
例子2:
#!/bin/bashecho "Please input the num(1-10):"read numuntil [[ "$num" = 4 ]]do if [ "$num" -lt 4 ];thenecho "Too small,Try again:"read num elif [ "$num" -gt 4 ];thenecho "To high,Try again:"read num elseexit 12 fidoneecho "congralutional,you got it."
结果:
~/Note/test # ./16until.sh Please input the num(1-10):5To high,Try again:3Too small,Try again:4congralutional,you got it.
阅读全文
0 0
- shellScript之util语句
- shellScript之if_else语句
- shellScript之if_elif_else语句
- shellScript之case语句
- shellScript之for语句
- shellScript之while语句
- shellScript之while语句
- shellScript之continue语句
- shellScript之select语句
- shellScript之嵌套if_else语句
- shellscript之简单的if语句
- shellScript之位置参数
- shellScript之break关键字
- shellScript之hello函数
- shellScript之数组操作1
- shellScript之数组操作2
- shellScript之数组操作3
- shellScript之数组操作4
- 四种方法解析XML文档:Dom、SAX、JDOM、dom4j
- CSS 实现自定义样式的单选框与多选框
- 左程云_算法与数据结构 — 链表问题 — 06环形单链表的约瑟夫问题_normal&advanced
- LOGBACK 配置: 用 XML
- Spark RDD和Dataset区别
- shellScript之util语句
- 【脚本语言系列】关于Python结构化文本文件处理JSON,你需要知道的事
- Spinal Tap Case
- 机器学习笔记十五 AdaBoost(未完)
- com.microsoft.sqlserver.jdbc.SQLServerException: 将截断字符串或二进制数据。
- 利用Data URL(data:image/jpg;base64,)将小图片生成数据流形式
- 面试题12—打印1到最大的n位数
- 机器学习笔记十六 K-均值聚类算法
- 九度oj-1062-分段函数