]>
Commit | Line | Data |
---|---|---|
d166f048 | 1 | abc |
3185942a | 2 | ./redir.tests: line 15: /tmp/redir-test: cannot overwrite existing file |
d166f048 JA |
3 | abc |
4 | def | |
5 | def | |
3185942a | 6 | ./redir.tests: line 31: $z: ambiguous redirect |
d166f048 JA |
7 | Point 1 |
8 | Point 2 | |
9 | to a | |
10 | to b | |
11 | Point 3 | |
12 | to a | |
13 | to a | |
14 | to b | |
15 | to b | |
16 | Point 4 | |
17 | to c | |
18 | Point 5 | |
19 | this is redir1.sub | |
20 | this is redir2.sub | |
21 | read line1 "ab" | |
22 | read line2 "root" | |
23 | read line3 "cd" | |
24 | read line4 "daemon" | |
25 | from stdin: aa | |
26 | to stdout | |
7117c2d2 JA |
27 | ./redir4.sub: line 32: $fd: ambiguous redirect |
28 | ./redir4.sub: line 33: $fd: ambiguous redirect | |
d166f048 JA |
29 | /tmp/err-and-out: |
30 | to stdout | |
31 | to stderr | |
32 | /tmp/err-and-out: | |
33 | to stdout | |
34 | to stderr | |
35 | 0 -- 3 0 | |
36 | 0 -- 4 0 | |
37 | ab | |
38 | cd | |
39 | ef | |
40 | gh | |
41 | ij | |
42 | kl | |
43 | 0 | |
44 | ab | |
45 | cd | |
46 | cd | |
3185942a | 47 | ./redir.tests: line 154: redir1.*: No such file or directory |
7117c2d2 JA |
48 | # tests of ksh93-like dup-and-close redirection operators |
49 | exec 9<$0 | |
50 | ||
51 | f() | |
52 | { | |
53 | exec 5<$0 | |
54 | ||
55 | exec 0<&5- | |
56 | ||
57 | while read line; do | |
58 | echo "$line" | |
59 | done | |
60 | } | |
61 | ||
62 | f | |
63 | ||
64 | typeset -f f | |
65 | ||
66 | # make sure it was closed | |
67 | read -u 5 foo | |
68 | echo after read | |
69 | ||
70 | exec 5<&0 | |
71 | ||
72 | exec <&- | |
73 | ||
74 | read abcde | |
75 | ||
76 | exec 0<&9- | |
77 | read line | |
78 | echo $line | |
79 | f () | |
80 | { | |
0628567a | 81 | exec 5< $0; |
7117c2d2 JA |
82 | exec 0<&5-; |
83 | while read line; do | |
84 | echo "$line"; | |
85 | done | |
86 | } | |
87 | ./redir5.sub: line 20: read: 5: invalid file descriptor: Bad file descriptor | |
88 | after read | |
89 | ./redir5.sub: line 27: read: read error: 0: Bad file descriptor | |
90 | # tests of ksh93-like dup-and-close redirection operators | |
b80f6443 JA |
91 | / |
92 | / | |
93 | / | |
94 | 0 | |
95 | 0 | |
96 | 0 | |
95732b49 JA |
97 | before block |
98 | after block | |
99 | c1 is 1 | |
100 | c2 is 2 | |
101 | c3 is 3 | |
102 | c4 is 4 | |
3185942a JA |
103 | fd 10 |
104 | fd 8 | |
105 | fd 10 | |
106 | fd 8 | |
107 | 1 | |
108 | 2 | |
109 | 3 | |
110 | 4 | |
111 | 1 | |
112 | 2 | |
113 | 3 | |
114 | 4 | |
115 | cat /tmp/foo | |
116 | whatsis | |
117 | hey | |
118 | to stdout | |
119 | to stderr | |
120 | ||
121 | to stdout | |
122 | to stderr | |
123 | ||
124 | to stderr | |
125 | to stdout | |
126 | ||
127 | to stderr | |
128 | hey | |
129 | to stdout | |
130 | logfunc is a function | |
131 | logfunc () | |
132 | { | |
133 | echo "$@" &>>$TMPDIR/log | |
134 | } | |
135 | foo | |
136 | bix is a function | |
137 | bix () | |
138 | { | |
139 | echo foo 2>&1 | cat | |
140 | } | |
141 | foo |