|
|
An AppleScript to ssh to multiple hosts in iTerm
I had some problems with the script as posted. Here's my version using examples from the iTerm Help page: -- Launch iTerm and log into multiple servers using SSH tell application "iTerm" activate -- Read serverlist from file path below set Servers to paragraphs of (do shell script "/bin/cat $HOME/serverlist") repeat with nextLine in Servers -- If line in file is not empty (blank line) do the rest if length of nextLine is greater than 0 then set server to "nextLine" set term to (current terminal) -- Open a new tab tell term launch session "Default Session" tell the last session write text "ssh " & nextLine -- sleep to prevent errors if we spawn too fast do shell script "/bin/sleep 0.01" end tell end tell end if end repeat -- Close the first tab since we do not need it terminate the first session of the current terminal end tell The only difference is the use of 'launch session' instead of 'make new session at the end of sessions' and 'write text' instead of 'exec command'. Works a treat on iTerm 0.9.5.0611 |
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.06 seconds |
|