projects
/
platform
/
upstream
/
bash.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
Imported from ../bash-2.03.tar.gz.
[platform/upstream/bash.git]
/
tests
/
redir4.sub
1
minus=-
2
3
# standard input
4
fd=0
5
6
exec 3<&$fd
7
8
read line <&3
9
echo from stdin: $line
10
11
# close fd 3
12
exec 3<&${minus}
13
14
# should give `bad fd', but exact error messages vary
15
# read line <&3
16
17
# standard output
18
fd=1
19
20
exec 4>&$fd
21
22
echo to stdout >&4
23
24
exec 4>&$minus
25
26
# should give `bad fd', but exact error messages vary
27
# echo to stdout >&4
28
29
unset fd
30
31
# these are ambiguous redirects
32
exec 3<&$fd
33
exec 4>&$fd
34
35
exec 3>&1 4>&2
36
37
exec >&/tmp/err-and-out
38
echo to stdout
39
echo to stderr >&2
40
41
exec 1>&3 2>&4
42
echo /tmp/err-and-out:
43
cat /tmp/err-and-out
44
45
rm /tmp/err-and-out
46
47
fd=/tmp/err-and-out
48
exec >&$fd
49
echo to stdout
50
echo to stderr >&2
51
52
exec 1>&3 2>&4
53
echo /tmp/err-and-out:
54
cat /tmp/err-and-out
55
56
rm /tmp/err-and-out