1 # Start telnet and when you press ^Z, put telnet in background and save any
2 # remaining output in "telnet.log". You can actually apply this technique
3 # to any interactive program - I just chose telnet here.
5 # Author: Don Libes, NIST, 1/5/95
7 spawn -ignore HUP telnet $argv ;# start telnet
8 interact \032 return ;# interact until ^Z
10 if {[fork]} exit ;# disconnect from terminal
13 set log [open logfile w] ;# open logfile
14 expect -re .+ { ;# and record everything to it
15 puts -nonewline $log $expect_out(buffer)