OILS / spec / testdata / ysh-for-stdin.ysh View on Github | oilshell.org

43 lines, 26 significant
1
2# I think <> is just stdin for now
3# Later we could add
4#
5# < >
6# < *.py README.md >
7# etc.
8
9seq 3 | for x in (io.stdin) {
10 echo "-$x-"
11}
12echo
13
14seq 3 | for i, x in (io.stdin) {
15 echo "$i $x"
16}
17echo
18
19echo 'empty'
20
21fopen < /dev/null {
22 for x in (io.stdin) {
23 echo "$x"
24 }
25}
26
27echo 'done'
28echo
29
30echo 'empty2'
31
32for x in (io.stdin) {
33 echo "$x"
34} < /dev/null
35
36echo 'done2'
37echo
38
39echo 'space'
40
41echo 'hi' | for x in ( io.stdin ) {
42 echo "$x"
43}