1#   This program is free software: you can redistribute it and/or modify
2#   it under the terms of the GNU General Public License as published by
3#   the Free Software Foundation, either version 3 of the License, or
4#   (at your option) any later version.
5#
6#   This program is distributed in the hope that it will be useful,
7#   but WITHOUT ANY WARRANTY; without even the implied warranty of
8#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
9#   GNU General Public License for more details.
10#
11#   You should have received a copy of the GNU General Public License
12#   along with this program.  If not, see <http://www.gnu.org/licenses/>.
13#
14a=4
15
16read -t 2 a < /dev/tty
17estat=$?
18if [ $estat -gt 128 ]; then
19	echo timeout 1: ok
20else
21	echo $estat
22fi
23
24echo $a
25
26sleep 5 | read -t 1 a
27estat=$?
28if [ $estat -gt 128 ]; then
29	echo timeout 2: ok
30else
31	echo $estat
32fi
33
34echo $a
35
36read -t -3 a < /dev/tty
37echo $?
38
39echo $a
40
41# the above should all time out
42echo abcde | {
43	read -t 2 a
44	echo $a
45}
46