Welcome back!
I just started using iTerm for Mac Os X instead of Terminal. The reason is mainly because I like the way the you can create a bookmark. I use this to make my rack time more efficient, however it will also work nicely for common connections I use at work.
Here is what I did:
First I created an expect script for each device in the pod I wanted to log into. This lets me save the username and password so I dont have to keep typing it. Once created, store them in a directory on your drive. Here is what they look like:
#!/usr/bin/expect -- spawn telnet Your-Terminal-Server-IP-or-Name Line-Number-Goes-Here expect "Username" send "YourUsername\r" expect "Password" send "YourPassword\r" expect "are" send "\r" interact;
Next open ITerm.
Select “Bookmarks”
Related posts:
- 12 Ways To Get The Most Out Of Lab Time Often times you may have rack time only to find...
Related posts brought to you by Yet Another Related Posts Plugin.



2 responses so far ↓
1 MBR // Jan 24, 2009 at 3:55 am
Great idea, Brandon! Thanks for posting it.
I expanded on your original script, to add an optional command line
arg for the device identifier (r1, sw1, etc), and to read files for
the values that change with each rack rental. The command line arg
lets you use one expect script for all devices. Using the file system
to store some values allows them to be updated easily from the command
line without bothering with an editor: “echo foo >file”
This all works fine with both iTerm and Terminal.app. In Terminal.app
just set the shell startup command and “Window > Save Windows as Group…”
You can save individual terminal settings with “Shell > Export Settings…”
but that’s much slower to startup (a couple of minutes vs a few seconds).
#!/usr/bin/expect –
#
# usage: ine [device]
# where device is r1, r2, etc
#
# 2009-01-19 Michael Rose mikerose@gmail.com
# Based on a script by Brandon Carroll
gets [open $env(HOME)/INE_PASS] pass
gets [open $env(HOME)/INE_RACK] rack
set device [lindex $argv 0]
set user “scrack$rack$device”
spawn telnet racks.internetworkexpert.com
expect “Username:”
send “$user\r”
expect “Password:”
send “$pass\r”
puts “\r”
sleep 2
send “\r”
interact;
2 Brandon // Apr 23, 2009 at 5:58 pm
Mike- I dont know how I missed this comment but wanted to say: Great Job!
Regards,
Brandon
Leave a Comment