]>
Commit | Line | Data |
---|---|---|
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 |
15 | stuff() | |
16 | { | |
17 | c=1 | |
18 | ( sleep 5 < /dev/null >/dev/null 2>&1 & ) & | |
19 | } | |
20 | ||
21 | exec 3>&1 | |
22 | eval ` | |
23 | exec 4>&1 >&3 3>&- | |
24 | { | |
25 | stuff 4>&- | |
26 | echo "c=$c" >&4 | |
27 | }` | |
28 | echo c1 is $c | |
29 | ||
30 | unset -f stuff | |
31 | ||
32 | stuff() | |
33 | { | |
34 | c=2 | |
35 | ( sleep 5 < /dev/null >/dev/null 2>&1 & ) | |
36 | } | |
37 | ||
38 | exec 3>&1 | |
39 | eval ` | |
40 | exec 4>&1 >&3 3>&- | |
41 | { | |
42 | stuff 4>&- | |
43 | echo "c=$c" >&4 | |
44 | }` | |
45 | echo c2 is $c | |
46 | ||
47 | unset -f stuff | |
48 | ||
49 | stuff() | |
50 | { | |
51 | c=3 | |
52 | { sleep 5 < /dev/null >/dev/null 2>&1 & } & | |
53 | } | |
54 | ||
55 | exec 3>&1 | |
56 | eval ` | |
57 | exec 4>&1 >&3 3>&- | |
58 | { | |
59 | stuff 4>&- | |
60 | echo "c=$c" >&4 | |
61 | }` | |
62 | echo c3 is $c | |
63 | ||
64 | unset -f stuff | |
65 | ||
66 | stuff() | |
67 | { | |
68 | c=4 | |
69 | { sleep 5 < /dev/null >/dev/null 2>&1 & } | |
70 | } | |
71 | ||
72 | exec 3>&1 | |
73 | eval ` | |
74 | exec 4>&1 >&3 3>&- | |
75 | { | |
76 | stuff 4>&- | |
77 | echo "c=$c" >&4 | |
78 | }` | |
79 | echo c4 is $c | |
80 | ||
81 | # fixed in bash-3.1 | |
82 | echo 'exec <&3' | ${THIS_SH} 3<&0 |