Re: Opening multiple windows in a screen from a detached state.

"David T. Pierson" <dtp-tWP3OOf8k3DqlBn2x/[email protected]>
Newsgroups gmane.comp.gnu.screen.user
Message-ID <1399166810.1540%[email protected]>
On Wed, Apr 23, 2014 at 06:55:29PM -0400, David Blackman-Mathis wrote:
> I am trying to automate the process of running, in parallel, every
> file in a directory in new windows in a new screen session.  The
> portion of this I'm missing is the ability, from an attached state, to
> open a new window and name it.  I think this might have to do with the
> screen "screen" command, but I can't find any working examples of what
> I'm looking for, and it's incredibly difficult to google that term.
> 
> I can get as far as:
> screen -D -dmS practice -t first

This response is probably too late to be useful, and I'm not sure I
understand exactly what you were looking for, but perhaps this will help
someone:

If you are within a screen session, to start a new window just invoke:

  screen -t newtitle newcommand

for each command you want a new window for.

If you want to start a completely new screen session with multiple
windows, 2 approaches come to mind:

If the set of commands is predetermined, create a custom config
containing:

  screen -t firstwindow firstcommand
  screen -t secondwindow secondcommand
  screen -t thirdwindow thirdcommand

and start the screen session using 

  screen -d -m -S sessionname -c config

If the set of commands is to be determined dynamically, you can create a
shell script that starts the new session in detached mode and then sends
the dynamically determined commands to it with screen -X:

  screen -d -m -S sessionname
  screen -r sessionname -X screen -t firstwindow firstcommand
  screen -r sessionname -X screen -t secondwindow secondcommand
  screen -r sessionname -X screen -t thirdwindow thirdcommand

(Actually creating the detached session will create a window too, so the
above will result in a session with 4 windows.)


David
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.