]> git.saurik.com Git - apple/shell_cmds.git/blob - sh/tests/builtins/read2.0
shell_cmds-216.60.1.tar.gz
[apple/shell_cmds.git] / sh / tests / builtins / read2.0
1 # $FreeBSD: head/bin/sh/tests/builtins/read2.0 212187 2010-09-03 21:17:33Z jilles $
2
3 set -e
4 {
5 echo 1
6 echo two
7 echo three
8 } | {
9 read x
10 [ "$x" = 1 ]
11 (read x
12 [ "$x" = two ])
13 read x
14 [ "$x" = three ]
15 }
16
17 T=`mktemp sh-test.XXXXXX`
18 trap 'rm -f "$T"' 0
19 {
20 echo 1
21 echo two
22 echo three
23 } >$T
24 {
25 read x
26 [ "$x" = 1 ]
27 (read x
28 [ "$x" = two ])
29 read x
30 [ "$x" = three ]
31 } <$T