summaryrefslogtreecommitdiff
path: root/example/timed-read
blob: 8e63f0f9531cdd6f23bcf9dfc6cf96fabf903fce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
#!/bin/sh
# -*- tcl -*-
# The next line is executed by /bin/sh, but not tcl \
exec tclsh "$0" ${1+"$@"}

package require Expect

# read a complete line from stdin
# aborting after the number of seconds (given as an argument)
# - Don Libes
set timeout $argv
expect -re \n {send_user $expect_out(buffer)}