Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

Is there any way to automate a bunch of terminals starting up at once. I find myself opening several windows and running the same sequence of commands in various tabs. I'd like to stick all this in a single shell file (so I could keep it in version control, share it, etc) rather than have to add it all to a GUI.

Ideally with iTerm, but automating with any terminal program would be interesting to hear about.

share|improve this question
    
Tmux has worked wonders for me since asking this question. –  mahemoff Oct 18 '13 at 17:02
add comment

1 Answer

up vote 2 down vote accepted

You could run your shell script from ~/.bashrc. Then no matter which client you use it will be executed when you open a new shell.

share|improve this answer
    
Sure, but I'm trying to run 20 different scripts, one for each pre-defined tab. –  mahemoff Jun 2 '12 at 2:48
1  
In your shell script you could base what code is run on what your ttys for that tab is set to. tty will give you that information. –  dennis.hempler Jun 2 '12 at 3:25
    
Nice, it's /dev/ttys022, so I could write a script to loop from 001 to 030 for example and call a function like init001 etc. I'm still not sure if there's any way to automate the windows though - ie 4 windows in first terminal, 8 in second, etc. –  mahemoff Jun 2 '12 at 10:11
2  
You could use some AppleScript with iTerm to automate opening sessions and tabs. code.google.com/p/iterm2/wiki/AppleScript –  dennis.hempler Jun 2 '12 at 11:44
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.