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.

  • Tmux has worked wonders for me since asking this question. – mahemoff Oct 18 '13 at 17:02

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.

  • 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. – dhempler 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
  • 3
    You could use some AppleScript with iTerm to automate opening sessions and tabs. code.google.com/p/iterm2/wiki/AppleScript – dhempler Jun 2 '12 at 11:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .