You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
608 B

5 years ago
# **let**
7 years ago
6 years ago
## 说明
7 years ago
5 years ago
**let命令** 是bash中用于计算的工具提供常用运算符还提供了方幂`**`运算符。在变量的房屋计算中不需要加上`$`来表示变量,
如果表达式的值是非0那么返回的状态值是0否则返回的状态值是1
7 years ago
5 years ago
## 选项
7 years ago
5 years ago
```markdown
7 years ago
自加操作`let no++`
自减操作`let no--`
简写形式`let no+=10``let no-=20`,分别等同于`let no=no+10``let no=no-20`
5 years ago
```
7 years ago
5 years ago
## 实例
7 years ago
5 years ago
```bash
7 years ago
#!/bin/bash
let a=5+4 b=9-3
echo $a $b
#!/bin/bash
let "t1 = ((a = 5 + 3, b = 7 - 1, c = 15 - 4))"
echo "t1 = $t1, a = $a, b = $b"
```