Bri*_*ian 4 keyboard-shortcuts bash shell process
是否可以暂停由另一个 bash 调用的 bash?例如,如果我曾经su
成为一个不同的用户,但想暂时切换回我自己的用户。再举一个例子,在 SSH 会话中,我可以使用 ~ 快捷方式 (~, ^Z) 挂起远程 shell 并返回到我的本地 shell(但这显然是 SSH 功能,而不是 shell)。
bash 拦截 ^Z 以进行自己的过程控制,因此它必须是一个单独的命令(如果它甚至受支持)。但是试图找到它只会导致有关正常过程控制的信息。
尝试:
kill -STOP $$
Run Code Online (Sandbox Code Playgroud)
其中$$
是PID
当前外壳。
您可以将它绑定到Alt+z例如通过添加到~/.inputrc
:
"\ez": "kill -STOP $$\n"
Run Code Online (Sandbox Code Playgroud)
Bash 有一个suspend
内置:
suspend: suspend [-f]
Suspend shell execution.
Suspend the execution of this shell until it receives a SIGCONT signal.
Unless forced, login shells cannot be suspended.
Options:
-f force the suspend, even if the shell is a login shell
Exit Status:
Returns success unless job control is not enabled or an error occurs.
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
1392 次 |
最近记录: |