|
From: | Pierre Gaston |
Subject: | Re: redirection inside a process-substitution |
Date: | Tue, 23 Aug 2016 14:57:48 +0300 |
When doing redirection inside a sub-process to a descriptor that is
redirected to a file the output of the subshell goes into the file.
Now when the same descriptor is again redirected to another descriptor for this whole
command-list, the output of the sub-process goes to the other descriptor.
Except when the subshell is subject to process-substitution: In this
case the outer redirection has no effect to the sub-process. Why is that?
Example:
rm -f tb.err
exec 3>tb.err
echo ------ 1 ----------
(echo 1 1>&3) 3>&1
echo ........tb.err ...........
cat tb.err
echo ------ 2 ---------
echo >(echo 2 1>&3) 3>&1
echo ........tb.err ...........
cat tb.err
echo ------ 3 ---------
echo >(echo 3 1>&3)
echo ........tb.err ...........
cat tb.err
Only test 3 should print 3 into tb.err. bash and ksh93 also print
into tb.err in test 2, which is inconsistent compared to case 1. What's so
special about process-substitution regarding redirection?
-Helmut
[Prev in Thread] | Current Thread | [Next in Thread] |