I have a screen session. I'd like to be able to figure out what's running in it from an external script. I've gotten this far:
ps --ppid $PID -o comm=
That prints a list of all the child processes of the screen. What I haven't been able to figure out so far is:
- What window is selected/active in a screen session.
- If $PID is an attached screen it has no children. How do I find out what session it's attached to?
I imagine the solution will involve some 'screen -X' voodoo, but I haven't figured out how to make that happen yet and google has been less than helpful.