Question

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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top