shell 编程中的 while 语句
来源:互联网 发布:程序员平均薪资 编辑:程序博客网 时间:2024/05/02 01:02
#!/bin/bash
total=0
#while(( $aa <= 5 ))
while [[ "$aa" != 5 ]]
do
echo "$aa"
aa=`expr $aa + 1`
total=`expr $total + $aa`
echo "## $total"
done
==================================
这里需要注意的是:
1. while 语句旁边的 [ 必须和 while 之间有一个空格。[[ 和 ]] 挨在一起。 ] 和 5 之间有个空格
2. 如果想把变量当数字进行运算 `expr XXXXXX` 两边的符号 ` 就是数字1左边的那个符号
3.aa=`expr $aa + 1` 注意等号两边不能有空格
是很简单,但是...... 记录一下吧。
- shell 编程中的 while 语句
- Shell中的if else语句 while语句
- Shell 编程7(循环语句while)
- Shell中的循环语句for、while、until
- while语句–shell
- shell脚本:while语句
- Linux学习---shell编程(14-while语句)
- Shell中的循环语句总结(for, while, until)
- Shell中的循环语句for、while、until实例讲解
- shell 中的for循环while循环和case语句
- shell 中的for、while循环及if语句
- shell while do编程
- Shell中的while循环
- Shell中的while循环
- SHELL中的while循环
- shell 学习之while语句
- 嵌入式 shell中while语句
- shell 学习之while语句
- 【wikioi】1010 过河卒
- IO总结(六)
- s q l i t e 加密 - S Q L C i p h e r
- CCS中调试DM6467高清视频采集(TVP7002输入)
- 黑马程序员--java异常学习笔记
- shell 编程中的 while 语句
- CODE 86: Permutations II
- 【wikioi】1011 数的计算
- linux vmware player 虚拟网络配置
- 非常对象访问常成员函数,导致内部this指针无法访问非常成员函数
- ruby之 周期性任务
- 编译htop命令
- 算法习题25:写一个函数,它的原形是int continumax(char *outputstr,char *intputstr)
- Android Application对象