summary refs log tree commit diff
path: root/bin/cash/tests/builtins/read2.0
blob: f41acd515b942528985cc89e44d1c182d39f7069 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# $FreeBSD: releng/12.0/bin/sh/tests/builtins/read2.0 212187 2010-09-03 21:17:33Z jilles $

set -e
{
	echo 1
	echo two
	echo three
} | {
	read x
	[ "$x" = 1 ]
	(read x
	[ "$x" = two ])
	read x
	[ "$x" = three ]
}

T=`mktemp sh-test.XXXXXX`
trap 'rm -f "$T"' 0
{
	echo 1
	echo two
	echo three
} >$T
{
	read x
	[ "$x" = 1 ]
	(read x
	[ "$x" = two ])
	read x
	[ "$x" = three ]
} <$T