Is there an elegant way, in the shell, to say “run this program until this other program is finished”?

I know I could run a thing, get a PID and then append a command with “&& kill pid” or something but that feels clunky.

@mhoye isn’t that what the ‘wait’ cmd does?

Edit: oh I understand what you’re saying. That sounds more complicated and now I also want to know if there’s an existing solution.

@waffles I thought wait was “pause here until a process exits and then continue” but not “run foo until that process exits” without extra work.
@mhoye @waffles the "until" in "run foo until" suggests a signal at the end though, which means you've got all the usual signal handling choices (HUP? INT? TERM? KILL? start with one and escalate?), so "$!" and kill and wait seems somewhat necessary
@mhoye @waffles not to mention who wants what file descriptors. can you say anything else about the underlying problem?
@glyph @waffles Really, the underlying problem is that I have a program to run that's single threaded, offers no visible progress indicators and might take ages. All I want is "run [screensaver] until [job] finishes then pop up [alert]"
@mhoye @glyph @waffles
ok I'm firing from the hip here, but will a bash coprocess help?