I have a screen session running with several windows. I want to attach to it, create a new screen window within it and start a shell in that new window.
Question: How can I do this from the command line outside the screen session?
I already tried a lot, e. g.
I found something on the mailing list, thank you tuxuday :)
I'm doing it now this way:
#!/bin/bash screen -X screen -t NEWWINDOW # create new window (switches existing attached terminal) sleep 0.1 screen -X other # switch existing attached terminal back to its old window sleep 0.1 gnome-terminal -e 'screen -x -p NEWWINDOW' # connect to new window
I'm not sure about those sleeps, maybe they aren't necessary in all environments, but I can wait those 0.2s easily.
.bash_aliases is changing the screen window title with a delay, so the awkward
NEWWINDOW won't stick for long (and thus not hinder further calls to this script).