It often happens that I have some long task running, like compiling a program, running tests or copying large archives. Once I am done with whatever else I was doing, I want to leave the computer unattended and have it shutdown or hibernate once it was done whatever it was doing.
To achieve this, I learned that I can suspend the process, then chain the fg command, e.g. fg && shutdown. What if I change my mind and no longer want the other command to run?
I believe the fg part is mostly irrelevant here, and the question boils down to how in foo && bar prevent bar from running while allowing foo to finish.