]>
Commit | Line | Data |
---|---|---|
495aee44 CR |
1 | : ${TMPDIR:=/var/tmp} |
2 | SHELLSFILE=$TMPDIR/shells-$$ | |
3 | ||
4 | cat > $TMPDIR/shells-$$ <<EOF | |
5 | /bin/bash | |
6 | /bin/csh | |
7 | /bin/ksh | |
8 | /bin/sh | |
9 | /bin/tcsh | |
10 | /bin/zsh | |
11 | EOF | |
12 | ||
13 | oclosev() | |
14 | { | |
15 | exec {v}>&- | |
16 | } | |
17 | ||
18 | iclosev() | |
19 | { | |
20 | exec {v}<&- | |
21 | } | |
22 | ||
23 | exec {v}>&1 | |
24 | echo $v | |
25 | ||
26 | echo foo 1 >&$v | |
27 | echo foo 2 >&$v | |
28 | echo foo 3 >&$v | |
29 | ||
30 | oclosev | |
31 | ||
32 | exec {v}<$SHELLSFILE | |
33 | echo $v | |
34 | ||
35 | while read line <&$v | |
36 | do | |
37 | echo $line | |
38 | done | |
39 | ||
40 | iclosev | |
41 | ||
42 | type oclosev | |
43 | type iclosev | |
44 | ||
45 | while read -r -u ${fd} | |
46 | do | |
47 | echo $REPLY | |
48 | done {fd}<$SHELLSFILE | |
49 | ||
50 | rm -f $SHELLSFILE | |
51 | ||
52 | exit 0 |