Nat*_*ver 5 bash signals line-editor fc
我一直在使用 bash 的edit-and-execute-command
功能:
edit-and-execute-command (C-x C-e)
在当前命令行调用编辑器,并将结果作为 shell 命令执行。Bash 尝试按照编辑器的顺序调用
$VISUAL
、$EDITOR
和emacs
。
https://www.gnu.org/software/bash/manual/html_node/Miscellaneous-Commands.html
我注意到如果我调用一个编辑器,使用 Ctrl-Z 把它放到后台,然后再用fg
把它放回前台,shell 不再执行临时文件。
如果我想中止命令,这很方便,但我发现这种行为在第一次发生时有点令人惊讶。
我的问题:
为什么会发生这种情况?
我从edit_and_execute_command
最终调用fc
的源代码中知道,但我并不清楚
为什么发送 SIGTSTP 会阻止 bash 执行临时文件。
如果我不小心按了 Ctrl-Z 并且仍然想在编辑器仍然打开的临时文件中执行脚本,那么最好的方法是什么?