This will do it:
#!/usr/local/bin/expect -f
#exp_internal 1 #<--------------- you
could uncomment this to turn debug mod on
set timeout 2
set prompt "(%|#|\\$) $" ;# default prompt
log_user 1
catch {set prompt $env(EXPECT_PROMPT)}
eval spawn less foo.txt #<---------------- make sure
this points to your file
set my_i 0
set my_prompt "Press /, g, q, or t to proceed -> "
interact {
"/" {send "/REPT\r"}
"g" {send "g\r"; expect; send_user $my_prompt }
"q" {send_user "\nDone\n\n"; exit}
"t" {
set my_i 0
while 1 {
if { $my_i < 3 } {
incr my_i
exp_send "f"
send_user "panakj $my_i " #<---------------- modify
this message
sleep 2;
expect #<--------------- this was your problem.
Without some form of interaction, expect waits, in your case "panakj prints
3 times"
} else {
break #after 3 attempts, exit the loop
}
}
send_user $my_prompt #<------- just something fun
}
eof { send_user "End of the File!\n"; exit }
}
------------------------------------------------
I did not wast time on the second block, if you want me to, let me know.
__________________
William Ampeh (x3939)
Federal Reserve Board
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]