I want to do something like this:
#!/bin/bash
screen -r session -X run 'long-cleanup-and-quit'
doing-something-else
...
Which is fine, but I want 'doing-something-else' to wait for screen. screen -X doesn't block, which is understandable.
So is there a way to have screen -r session -X run 'long-cleanup-and-quit'
attach, run command, but do NOT detach? Eventually the command will terminate the process/screen so the script can continue.
My workaround so far is to just loop for the process and wait.