Posted to tcl by mjanssen at Wed Oct 17 15:20:44 GMT 2007view pretty
package require Expect set prompt "????? " spawn telnet ***** log_user 0 expect -ex login: send ******\r expect -ex word: send ******\r expect -ex $prompt send "ls -R\r" expect -re "(.*?)\n" puts "line with command ignored" set txt {} expect { -ex $prompt {puts done} -re "(.*?)\n" { append ::txt $expect_out(1,string)\n ; exp_continue} } set f [open test.txt2 w] puts -nonewline $f $txt close $f exit