]>
Commit | Line | Data |
---|---|---|
495aee44 CR |
1 | 10 |
2 | foo 1 | |
3 | foo 2 | |
4 | foo 3 | |
5 | bar is a function | |
6 | bar () | |
7 | { | |
8 | exec {v}> $TMPFILE; | |
9 | echo $v | |
10 | } | |
11 | ./vredir.tests: line 6: v: readonly variable | |
12 | ./vredir.tests: line 6: v: cannot assign fd to variable | |
13 | 42 | |
14 | ./vredir.tests: line 25: $v: Bad file descriptor | |
15 | ./vredir.tests: line 26: $v: Bad file descriptor | |
16 | ./vredir.tests: line 27: $v: Bad file descriptor | |
17 | bar is a function | |
18 | bar () | |
19 | { | |
20 | exec {v}> $TMPFILE; | |
21 | echo $v | |
22 | } | |
23 | 11 | |
24 | line 1 | |
25 | line 2 | |
26 | line 3 | |
27 | bar is a function | |
28 | bar () | |
29 | { | |
30 | exec {v}<<EOF | |
31 | line 1 | |
32 | line 2 | |
33 | line 3 | |
34 | EOF | |
35 | ||
36 | echo $v | |
37 | } | |
38 | 11 | |
39 | foo 1 | |
40 | foo 2 | |
41 | foo 3 | |
42 | 11 | |
43 | /bin/bash | |
44 | /bin/csh | |
45 | /bin/ksh | |
46 | /bin/sh | |
47 | /bin/tcsh | |
48 | /bin/zsh | |
49 | oclosev is a function | |
50 | oclosev () | |
51 | { | |
52 | exec {v}>&- | |
53 | } | |
54 | iclosev is a function | |
55 | iclosev () | |
56 | { | |
57 | exec {v}>&- | |
58 | } | |
59 | /bin/bash | |
60 | /bin/csh | |
61 | /bin/ksh | |
62 | /bin/sh | |
63 | /bin/tcsh | |
64 | /bin/zsh | |
65 | ./vredir3.sub: line 4: v: ambiguous redirect | |
66 | after | |
67 | 11 12 | |
68 | a | |
69 | a | |
70 | swizzle is a function | |
71 | swizzle () | |
72 | { | |
73 | fd0=0; | |
74 | fd1=1; | |
75 | exec {stdin}<&$fd0; | |
76 | exec {stdout}>&$fd1 | |
77 | } | |
78 | 13 11 | |
79 | a | |
80 | a | |
81 | swizzle is a function | |
82 | swizzle () | |
83 | { | |
84 | exec {fd0}<&0; | |
85 | exec {fd1}>&1; | |
86 | exec {stdin}<&$fd0-; | |
87 | exec {stdout}>&$fd1- | |
88 | } | |
89 | ok 1 | |
90 | ./vredir6.sub: redirection error: cannot duplicate fd: Invalid argument | |
91 | ./vredir6.sub: line 10: /dev/null: Invalid argument | |
92 | ./vredir6.sub: redirection error: cannot duplicate fd: Invalid argument | |
93 | ./vredir6.sub: line 13: v: Invalid argument | |
94 | unset |