This section is a work in progress.

Contents


Preamble


Easy fix

How about:

prog1 & prog2 && fg
  1. Start prog1.
  2. Send it to background, but keep printing its output.
  3. Start prog2, and keep it in foreground, so you can close it with ctrl-c.
  4. When you close prog2, you'll return to prog1's foreground, so you can also close it with ctrl-c.

Waiting

Do this to run several tasks (for example,job11 and job12), wait them to complete, and then continue running more tasks (for example, job21 and job22):

job11 &
job12
wait
job21 &
job22

Execute a bash script in the background

You can do this like so: