]>
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 | # | |
495aee44 CR |
14 | : ${TMPDIR:=/var/tmp} |
15 | SHELLSFILE=$TMPDIR/shells-$$ | |
16 | ||
17 | cat > $TMPDIR/shells-$$ <<EOF | |
18 | /bin/bash | |
19 | /bin/csh | |
20 | /bin/ksh | |
21 | /bin/sh | |
22 | /bin/tcsh | |
23 | /bin/zsh | |
24 | EOF | |
25 | ||
26 | oclosev() | |
27 | { | |
28 | exec {v}>&- | |
29 | } | |
30 | ||
31 | iclosev() | |
32 | { | |
33 | exec {v}<&- | |
34 | } | |
35 | ||
36 | exec {v}>&1 | |
37 | echo $v | |
38 | ||
39 | echo foo 1 >&$v | |
40 | echo foo 2 >&$v | |
41 | echo foo 3 >&$v | |
42 | ||
43 | oclosev | |
44 | ||
45 | exec {v}<$SHELLSFILE | |
46 | echo $v | |
47 | ||
48 | while read line <&$v | |
49 | do | |
50 | echo $line | |
51 | done | |
52 | ||
53 | iclosev | |
54 | ||
55 | type oclosev | |
56 | type iclosev | |
57 | ||
58 | while read -r -u ${fd} | |
59 | do | |
60 | echo $REPLY | |
61 | done {fd}<$SHELLSFILE | |
62 | ||
63 | rm -f $SHELLSFILE | |
64 | ||
65 | exit 0 |