blob: e176d8934a2b79d8720b68c4e4773dad1ac98f43 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# Tests for process substitution: <(...), >(...) and =(...).
%prep
if grep '#define PATH_DEV_FD' $ZTST_testdir/../config.h > /dev/null 2>&1 ||
grep '#define HAVE_FIFOS' $ZTST_testdir/../config.h > /dev/null 2>&1; then
mkdir procsubst.tmp
cd procsubst.tmp
print 'First\tSecond\tThird\tFourth' >FILE1
print 'Erste\tZweite\tDritte\tVierte' >FILE2
else
ZTST_unimplemented="process substitution is not supported"
true
fi
function copycat { cat "$@" }
%test
paste <(cut -f1 FILE1) <(cut -f3 FILE2)
0:<(...) substitution
>First Dritte
# slightly desperate hack to force >(...) to be synchronous
{ paste <(cut -f2 FILE1) <(cut -f4 FILE2) } > >(sed 's/e/E/g' >OUTFILE)
cat OUTFILE
0:>(...) substitution
>SEcond ViErtE
diff =(cat FILE1) =(cat FILE2)
1:=(...) substituion
>1c1
>< First Second Third Fourth
>---
>> Erste Zweite Dritte Vierte
copycat <(print First) <(print Zweite)
0:FDs remain open for external commands called from functions
>First
>Zweite
|