#!/usr/local/bin/expect # # This script automates logging in to a remote system, trying phone # numbers from a list until it finds one that works. # # Bennett Todd, Oct. 12 1994 # # Change the phone numbers below to the ones you want to use. # Have $HOME/.kermrc set up to pick the right line, comm parameters, # etc. set phonenos [list 5551111 5552222 5553333] spawn kermit; expect "C-Kermit>" send "c\r"; expect "other options." sleep 1;set timeout 45;log_user 1 foreach f [set phonenos] { send "ATDT$f\r" expect { CONNECT {interact; exit} -re {BUSY|NO ANSWER} {} } } send "\034c"; expect "C-Kermit>" send "hang\r"; expect "C-Kermit>" send "q\r" wait