Posted to tcl by rmax at Wed Oct 06 09:45:50 GMT 2021view pretty

if {$argc == 1} {
    for {set i 0} {$i < 10} {incr i} {
	puts $i
	after 1000
    }
} else {
    package require Expect
    spawn $argv0 x
    expect 5 {puts "got five!"}
}