0

Is there a way to list all window names and depending on the result, creating a new window with a specific name into this (running) session.

How to create a new screen session with assigned window names is documented in the man pages, but i could find information about a solution to the problem above.

Adrian Frühwirth
  • 42,970
  • 10
  • 60
  • 71
inselberg
  • 549
  • 3
  • 13
  • 27
  • look http://stackoverflow.com/questions/995803/creating-new-windows-that-run-programs-in-screen?rq= – Jayesh Bhoi Apr 10 '14 at 09:17
  • that explains how to start a new session/create a window manually. I asked how to create a window programmatic in a running screen session. – inselberg Apr 10 '14 at 09:27

1 Answers1

1

From outside the screen session, I don't think so. But if you are starting from inside, in one of the windows of the right screen session, then yes:

for window_name in foo bar baz quux ; do    ## ...
    screen -t $window_name
done

You can even get fancy and run some initial commands in each window! This snipped of copy-paste bash helps me get back to work quickly after a reboot. Once I've started the screen session:

for n in $(seq 1 8) ; do    ## ...
    screen -t proj_$n bash -c "cd /src/foo/proj_$n*/ ;"\
' eval `set_proj_env_vars.sh` ; svn status ; make clean ; make ;'\
' exec bash --login'
done

...and as a great side effect the screen windows are numbered for the various checkouts, where each one can be working on a different bug/feature. Overkill? Totally! But it's a fun hack.

DouglasDD
  • 395
  • 3
  • 11