Linux 下的 shell 编程之 while 循环
2016-07-14 19:16
429 查看
linux 下 while 循环中可以使用 break 和 continue 关键字来跳出循环, 和java 用法一致
一 循环结构:
二 用法示例
一 循环结构:
while [ 条件判断式 ] do 程序块儿 break/continue done
二 用法示例
#!/bin/bash #Desc for test while #Auth zonggf #Date 2016-07-02 12:20:21 i=1 sum=0 while [ $i -le 100 ] do sum=$(( $sum + $i )) i=$(( $i + 1 )) done echo "1+2+3+4+...+100=$sum"
相关文章推荐
- Linux 下的 shell 编程之 for 循环
- Linux 下的 shell 编程之 case 多分支选择
- shell脚本杂七杂八问题
- Linux 下的 shell 编程之 if-else选择结构
- shell脚本,在循环体中执行ssh命令的问题
- Shell脚本
- Bash的变量和参数
- Linux Shell脚本编程之if用法示例
- shell 中变量的截取
- 几个简单的shell脚本
- Shell程序设计
- Shell学习笔记
- Bash中的特殊字符
- Shell 编程之常用的字符串提取命令
- 习题3 数字和数学计算
- 一个解析cgi参数的SHELL脚本
- (Ubantu)使用gcc编译一个程序a.c成a.out,输入a.out运行,提示bash:a.out:command not found,怎么回事
- Java in Nutshell 摘要
- 【Shell】shell带有返回值的函数
- 变量的用法