Skip to content

Commit a2346f6

Browse files
authored
Create true.md
创建文件
1 parent 556c11c commit a2346f6

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

command/true.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
true
2+
===
3+
4+
返回状态为成功。
5+
6+
## 概要
7+
8+
```shell
9+
true
10+
```
11+
12+
## 主要用途
13+
14+
- 用于和其他命令进行逻辑运算。
15+
16+
## 返回值
17+
18+
返回状态总是成功;返回值为0。
19+
20+
## 例子
21+
22+
```shell
23+
# 当你的脚本设置set -e时,任何返回值为失败的命令都会使得脚本退出。
24+
set -e
25+
# 如何临时跳过呢?下面的语句使用逻辑或操作符连接true,返回值一定为真。
26+
some_command || true
27+
28+
# 当然,和python的pass一样,也可以用作条件语句临时占位。
29+
```
30+
31+
32+
### 注意
33+
34+
1. 该命令是bash内建命令,相关的帮助信息请查看`help`命令。
35+
36+
37+
<!-- Linux命令行搜索引擎:https://jaywcjlove.github.io/linux-command/ -->

0 commit comments

Comments
 (0)