summaryrefslogtreecommitdiff
path: root/example/reprompt
blob: 02db985788a0b0d518f85f7c5043e3dcfae87eec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/depot/path/expect --

# Name: reprompt
# Description: reprompt every so often until user enters something
# Usage: reprompt timeout prompt
# Author: Don Libes, NIST

foreach {timeout prompt} $argv {}

send_error $prompt
expect {
    timeout {
	send_error "\nwake up!!\a"
	send_error \n$prompt
	exp_continue
    }
    -re .+ {
	send_user $expect_out(buffer)
    }
}