击:接连运行一个命令,即使我暂停第一个(按Ctrl-Z) [英] Bash: run one command after another, even if I suspend the first one (Ctrl-z)
问题描述
我知道在bash我可以通过分号分隔它们,像
I know in bash I can run one command after another by separating them by semicolons, like
$ command1; command2
或者,如果我只是想命令2
仅在命令1
运行成功,使用&放;&安培;
:
$ command1 && command2
这工作,但如果我暂停命令1
使用 CTRL-Z
,在第一种情况下,它运行命令2
立即,以及在第二种情况下,它不运行它。我怎样才能按顺序运行命令,但仍然能够暂停第一个命令,但是不会有第二次运行,直到我已经重新启动它(使用 FG
),并完成?我想美元,简单地按p $ PFER的东西,因为我想以交互方式做到这一点。或者,也许我只是需要的地方设置一个选项。
This works, but if I suspend command1
using Ctrl-z
, in the first case, it runs command2
immediately, and in the second case, it doesn't run it at all. How can I run commands in sequence, but still be able to suspend the first command, but not have the second run until I have restarted it (with fg
) and it finishes? I'd prefer something as simple to type as possible, as I would like to do this interactively. Or maybe I just need to set an option somewhere.
顺便说一句,什么是适当的期限是什么 CTRL-Z
呢?
By the way, what is the proper term for what Ctrl-z
does?
推荐答案
下面应该这样做:
(command1; command2)
请注意添加的括号内。
这篇关于击:接连运行一个命令,即使我暂停第一个(按Ctrl-Z)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!