Skip to content

Commit dfb48ca

Browse files
authored
Create suspend.md
创建文件 bash作业控制系列的更新(1/6)
1 parent 98ba0da commit dfb48ca

1 file changed

Lines changed: 51 additions & 0 deletions

File tree

‎command/suspend.md‎

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
suspend
2+
===
3+
4+
挂起shell的执行。
5+
6+
## 概要
7+
8+
```shell
9+
suspend [-f]
10+
```
11+
12+
## 主要用途
13+
14+
- 挂起shell的执行,直到收到`SIGCONT`信号。
15+
16+
- 除非使用`-f`选项,否则无法对`login shell`使用。
17+
18+
19+
## 选项
20+
21+
```shell
22+
-f 对login shell执行挂起操作。
23+
```
24+
25+
## 返回值
26+
27+
返回成功除非未开启作业控制或发生了错误。
28+
29+
## 例子
30+
31+
```shell
32+
# 打开一个终端,首先获取PID。
33+
echo $$
34+
# 执行挂起命令
35+
suspend
36+
```
37+
38+
```shell
39+
# 再打开一个终端,发送SIGCONT命令
40+
kill -s SIGCONT PID
41+
# 此时之前的终端结束挂起状态,可以正常交互。
42+
```
43+
44+
### 注意
45+
46+
1. `bash`的作业控制命令包括`bg fg kill wait disown suspend`。
47+
2. 该命令需要`set`选项`monitor`处于开启状态时才能执行;查看作业控制状态:输入`set -o`查看`monitor`行;执行`set -o monitor`或`set -m`开启该选项。
48+
3. 该命令是bash内建命令,相关的帮助信息请查看`help`命令。
49+
50+
51+
<!-- Linux命令行搜索引擎:https://jaywcjlove.github.io/linux-command/ -->

0 commit comments

Comments
 (0)