Hello
I'm using GNU screen for an application that I'm making. I will try to explain:
This application opens 2 screen session, A and B. Screen session A has a script running in teh first window. I want to be able to switch from screen session A to screen session B, from the script running in session A (a convenience for the user)
The problem is: when ever I try to make screen B appear (screen -d -r B -- i've also tried screen -d A && screen -d -r B), it attaches as a child of screen session A (so now B is a subscreen of A) - where I'm actually intending to disconnect from session A, and show the user session B. I need to run these commands as if they were entered from outside of screen, but i'm not sure how to do that (somehow create a new process to run those commands in)
any ideas?
thanks!
---------- Post updated at 06:31 AM ---------- Previous update was at 05:52 AM ----------
I realize that its hard to properly explain what it is I need.. I whipped up a quick example...
start.sh:
#!/bin/bash
#create session A
screen -d -m -S A -t "SessionA-1" $HOME/monitor.sh
#and give it an extra tab..
screen -r A -X screen -t "SessionA-2"
#give it a hardstatus line so we can see which session we're in
screen -r A -X hardstatus on
screen -r A -X hardstatus alwayslastline
screen -r A -X hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%
{W}%n*%f%t%?(%u )%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %d/%m %{W}%c %{g}]'
#create sessionB
screen -d -m -S B -t "SessionB-1"
screen -r B -X screen -t "SessionB-2"
#give it a hardstatus line so we can see which session we're in
screen -r B -X hardstatus on
screen -r B -X hardstatus alwayslastline
screen -r B -X hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%
{W}%n*%f%t%?(%u )%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %d/%m %{W}%c %{g}]'
# now show session A to the user
screen -r A -p 0
monitor.sh
#!/bin/bash
echo " I'm going to show you session B in 10 seconds...."
sleep 10
screen -r B && screen -d A
put those both in your home folder and run ./start.sh
What happens: After 10 seconds, screen B is opened within screen A
What I want to happen: After 10 seconds, screen A is disconnected, and screen B is then shown to the user (not as a child of screen A)
so I'm sure this line is the problem:
screen -r B && screen -d A
I need it to run as a new process outside of screen.... any thoughts?