An AppleScript to ssh to multiple hosts in iTerm
Jul 12, '07 07:30:00AM
Contributed by: Anonymous
I tried finding a simple script to ssh to multiple hosts within iTerm, and couldn't find one. So I wrote this little AppleScript that does the following:
- Parses a list of systems in $HOME/serverlist (create this file and put your hosts listed one per line)
- Spawns a new tab in the current window
- Changes tab title to the name of the host
- Spawns an ssh session (using your username) to the host. Note that you can easily edit this to connect as root or whomever by changing the ssh line
- Bank lines should be ignored (I haven't played with this much, but it seemed to work when I have tried it)
One thing to note: I found that iTerm tends to freak out if we spawn too many tabs/sessions at once. To compensate, I added an extremely stupid group of echo statements to slow things down (this was quicker than a full one-second pause). If anyone has an solution for this, feel free to fix my lousy code.
Comments (14)
Mac OS X Hints
http://hints.macworld.com/article.php?story=20070711123202297