summaryrefslogtreecommitdiffstats
path: root/scratch/bash-3.1.orig/tests/redir.right
blob: 68bea526c298ccc80f72b6f9817bae517afaeaf0 (plain)
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
abc
./redir.tests: line 13: /tmp/redir-test: cannot overwrite existing file
abc
def
def
./redir.tests: line 29: $z: ambiguous redirect
Point 1
Point 2
to a
to b
Point 3
to a
to a
to b
to b
Point 4
to c
Point 5
this is redir1.sub
this is redir2.sub
read line1 "ab"
read line2 "root"
read line3 "cd"
read line4 "daemon"
from stdin: aa
to stdout
./redir4.sub: line 32: $fd: ambiguous redirect
./redir4.sub: line 33: $fd: ambiguous redirect
/tmp/err-and-out:
to stdout
to stderr
/tmp/err-and-out:
to stdout
to stderr
0 -- 3 0
0 -- 4 0
ab
cd
ef
gh
ij
kl
0
ab
cd
cd
./redir.tests: line 152: redir1.*: No such file or directory
# tests of ksh93-like dup-and-close redirection operators
exec 9<$0

f()
{
exec 5<$0

exec 0<&5-

while read line; do
echo "$line"
done
}

f

typeset -f f

# make sure it was closed
read -u 5 foo
echo after read

exec 5<&0

exec <&-

read abcde

exec 0<&9-
read line
echo $line
f () 
{ 
    exec 5<$0;
    exec 0<&5-;
    while read line; do
        echo "$line";
    done
}
./redir5.sub: line 20: read: 5: invalid file descriptor: Bad file descriptor
after read
./redir5.sub: line 27: read: read error: 0: Bad file descriptor
# tests of ksh93-like dup-and-close redirection operators
/
/
/
0
0
0
before block
after block
c1 is 1
c2 is 2
c3 is 3
c4 is 4