Without knowing ahead of time that I'll want to do this, is it possible to wait for a job to finish and automatically begin executing another one?
For example, I jump into a tmux session and execute
sudo apt update && sudo apt upgrade. Then I create a new pane and begin doing something, only to realize I need another package on my system I don't currently have. I have to wait for my update/upgrade process to finish, but it's chugging away and I don't want to have to wait for it, especially since I could be doing something else while it's going, rather than having to wait for it.
I'd be fine with
bg-ing the job, but my question is, is there a way to insert a job after that job is finished, so that I can
&& sudo apt install tree for example?
EDIT: this question is different from the linked question and answer, I think, because
job1 && job2
fg; echo "done" will see
echo "done" executed after
job2 apparently gets discarded. The way around it is to use a semicolon between
job2, but that's not a great solution for me.