#!/usr/bin/expect -f
# wait forever (positive number would be # of seconds)
set timeout 5
send_user "Machine Name/Address: "
expect_user -re "(.*)\n" {set MACHADDR $expect_out(1,string)}
#set MACHADDR "192.168.1.1"
send_user "Machine Name / Address is $MACHADDR\n"
send_user "Login: "
expect_user -re "(.*)\n" {set USERNAME $expect_out(1,string)}
send_user "Password: "
stty -echo
expect_user -re "(.*)\n" {set PASSWORD $expect_out(1,string)}
send_user "\n"
stty echo
#telnets to a term svr
spawn telnet $MACHADDR
#sleep 2
#send "\r"
expect "login"
send "$USERNAME\r"
expect "password"
send "$PASSWORD\r"
expect "LOGGED IN"