#File Name: scriptv2.exp #!/usr/bin/expect -- set timeout 5 set prompt "(%|#|\\$) $" ; catch {set prompt $env(EXPECT_PROMPT) } puts "Telnet into Home Agent Access Point" set tpid1 [ spawn telnet 120.10.10.100 ] expect "]:" send "=\r" expect "]:" send "s\r" expect "]:" send "ex\r" expect "]:" send "ra\r" expect "):" send "home\r" expect "]:" sleep 1 send "apply\r" exec kill -9 $tpid1 set tpid2 [ spawn telnet 120.10.10.100 ] expect "]:" send "=\r" expect "]:" send "s\r" expect "]:" send "ex\r" expect "]:" exec kill -9 $tpid2