Spawning Multiple Telnet Sessions with Expect in Parallel

actually works

# spawn all connections
foreach conn $allconnections {

 spawn telnet $conn
 lappend spawn_id_list $spawn_id

}

# run expect script for all connections individually
foreach id $spawn_id_list {

 # this is important - for unknown (to me) reasons
 set spawn_id $id

 send "your_send_message"
 expect "your_expect_pattern"

}

http://community.activestate.com/forum-topic/spawning-multiple-telnet-sessions-expect

Leave a Reply