Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

In .screenrc, I can have the lines:

screen -t title1 command1
screen -t title2 command2

I would like to create a batch file to add a few screens at once, what is the best way of going about that?

If I just run those two commands in a single batch file, I get screen start with command 1, but command 2 only executes when I exit the screen process.

An ampersand might do it but be a bit untidy, but I was wondering if there's a better method?

share|improve this question
    
Can you be more specific about the goals behind this? What are you trying to accomplish? –  Doug Harris Oct 8 '12 at 16:38
    
I have several environments, production, dev, uat - at work. I would like to run one command to initiate 3 screens, in a scripted file. I found that calling screen like above, the flow of control is halted by screen itself, and it's only upon exiting the second line runs. The idea of using a config file below looks like the best way of accomplishing it. –  polyglot Oct 24 '12 at 15:19
add comment

1 Answer 1

You could create a script to generate a new .screenrc file which adds enough screens to run what you want.

Your script could then launch screen after generating the .screenrc.

share|improve this answer
2  
Additional note, you don't have to overwrite ~/.screenrc either, you can specify a temporary file as the config file when starting screen. –  Darth Android Oct 8 '12 at 17:00
    
Darth Android has the best answer - thanks. –  polyglot Oct 24 '12 at 15:17
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.