I know in bash I can run one command after another by separating them by semicolons, like
$ command1; command2
Or if I only want command2
to run only if command1
succeeds, using &&
:
$ command1 && command2
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.
By the way, what is the proper term for what Ctrl-z
does?
The following should do it:
(command1; command2)
Note the added parentheses.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With