]> git.ipfire.org Git - thirdparty/bash.git/blame - tests/redir7.sub
Bash-5.2-rc4 release
[thirdparty/bash.git] / tests / redir7.sub
CommitLineData
8868edaf
CR
1# This program is free software: you can redistribute it and/or modify
2# it under the terms of the GNU General Public License as published by
3# the Free Software Foundation, either version 3 of the License, or
4# (at your option) any later version.
5#
6# This program is distributed in the hope that it will be useful,
7# but WITHOUT ANY WARRANTY; without even the implied warranty of
8# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9# GNU General Public License for more details.
10#
11# You should have received a copy of the GNU General Public License
12# along with this program. If not, see <http://www.gnu.org/licenses/>.
13#
95732b49
JA
14# weird redirections that caused trouble and were fixed in post-3.0 bash
15stuff()
16{
17 c=1
18 ( sleep 5 < /dev/null >/dev/null 2>&1 & ) &
19}
20
21exec 3>&1
22eval `
23exec 4>&1 >&3 3>&-
24{
25 stuff 4>&-
26 echo "c=$c" >&4
27}`
28echo c1 is $c
29
30unset -f stuff
31
32stuff()
33{
34 c=2
35 ( sleep 5 < /dev/null >/dev/null 2>&1 & )
36}
37
38exec 3>&1
39eval `
40exec 4>&1 >&3 3>&-
41{
42 stuff 4>&-
43 echo "c=$c" >&4
44}`
45echo c2 is $c
46
47unset -f stuff
48
49stuff()
50{
51 c=3
52 { sleep 5 < /dev/null >/dev/null 2>&1 & } &
53}
54
55exec 3>&1
56eval `
57exec 4>&1 >&3 3>&-
58{
59 stuff 4>&-
60 echo "c=$c" >&4
61}`
62echo c3 is $c
63
64unset -f stuff
65
66stuff()
67{
68 c=4
69 { sleep 5 < /dev/null >/dev/null 2>&1 & }
70}
71
72exec 3>&1
73eval `
74exec 4>&1 >&3 3>&-
75{
76 stuff 4>&-
77 echo "c=$c" >&4
78}`
79echo c4 is $c
80
81# fixed in bash-3.1
82echo 'exec <&3' | ${THIS_SH} 3<&0