File: vredir.right

package info (click to toggle)
bash 5.3-2
  • links: PTS
  • area: main
  • in suites: sid
  • size: 44,432 kB
  • sloc: ansic: 134,747; sh: 8,866; yacc: 5,966; makefile: 4,697; perl: 4,105; asm: 48; awk: 23; sed: 16
file content (123 lines) | stat: -rw-r--r-- 1,597 bytes parent folder | download | duplicates (2)
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
10
foo 1
foo 2
foo 3
bar is a function
bar () 
{ 
    exec {v}>> $TMPFILE;
    echo $v
}
./vredir.tests: line 19: v: readonly variable
./vredir.tests: line 19: v: cannot assign fd to variable
42
./vredir.tests: line 38: v: readonly variable
./vredir.tests: line 38: v: cannot assign fd to variable
bar is a function
bar () 
{ 
    exec {v}>> $TMPFILE;
    echo $v
}
10
line 1
line 2
line 3
bar is a function
bar () 
{ 
    exec {v}<<EOF
line 1
line 2
line 3
EOF

    echo $v
}
11
line 1
line 2
line 3
bar is a function
bar () 
{ 
    exec {v}<<-EOF
line 1
line 2
line 3
EOF

    echo $v
}
10
foo 1
foo 2
foo 3
10
/bin/bash
/bin/csh
/bin/ksh
/bin/sh
/bin/tcsh
/bin/zsh
oclosev is a function
oclosev () 
{ 
    exec {v}>&-
}
iclosev is a function
iclosev () 
{ 
    exec {v}>&-
}
/bin/bash
/bin/csh
/bin/ksh
/bin/sh
/bin/tcsh
/bin/zsh
./vredir3.sub: line 4: v: ambiguous redirect
after
10 11
a
a
swizzle is a function
swizzle () 
{ 
    fd0=0;
    fd1=1;
    exec {stdin}<&$fd0;
    exec {stdout}>&$fd1
}
10 11
10 11
./vredir4.sub: line 51: ${output}: Bad file descriptor
12 10
a
a
swizzle is a function
swizzle () 
{ 
    exec {fd0}<&0;
    exec {fd1}>&1;
    exec {stdin}<&$fd0-;
    exec {stdout}>&$fd1-
}
ok 1
./vredir6.sub: redirection error: cannot duplicate fd: Invalid argument
./vredir6.sub: line 13: /dev/null: Invalid argument
unset
12 10
a
a
swizzle is a function
swizzle () 
{ 
    exec {fd[0]}<&0;
    exec {fd[1]}>&1;
    exec {stdin}<&${fd[0]}-;
    exec {stdout}>&${fd[1]}-
}
redir 2
./vredir8.sub: line 33: $fd: Bad file descriptor
./vredir8.sub: line 38: $fd: Bad file descriptor