Can I expect some help with expect?

"Steven W. Orr" <[email protected]> Sun, 9 Jul 2006 20:47:49 -0400 (EDT)
Newsgroups gmane.mail.majordomo.majordomo2.devel
Organization SysLang
Message-ID <[email protected]>
Obviously, this is not an MJ2 problem, but I'm trying to write a script in 
expect to interface with mj2. Here's the idea:

Usage: 
mj_set setting address

example:
mjset nomail-10d [email protected]

The start of it is simple:

#! /usr/bin/expect -f
eval spawn -noecho "~majordomo/bin/mj_shell"
expect "Majordomo>"
send "default password mysecret\r"
expect "Majordomo>"
send "default user Zorro Gay Blade <[email protected]>\r"
expect "Majordomo>"
set addr [lindex $argv 0]
set setting [lindex $argv 1]
send "show $addr\r"
expect -re "Address: (.*)$" { puts "Got Address\n" }
set str [concat "addr = %" $expect_out(1,string) "%%\n"]
puts $str
expect -re "Subscribed to +\(\[0-9]+\) lists"
while { 1 } {
     puts "loopy\n"
     expect {
 	-re "^         [-a-z]+:\$" {
 	    # Got a list name here
 	}
 	"Majordomo>" {
 	    exit
 	}
     }
}

For the life of me, I have no idea how to get the last expect statement to 
work. Any brave souls out there? :-(

If I can get the statement to work it'll be easy to finish the script up.

-- 
Time flies like the wind. Fruit flies like a banana. Stranger things have  .0.
happened but none stranger than this. Does your driver's license say Organ ..0
Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
individuals! What if this weren't a hypothetical question?
steveo at syslang.net