[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

redirection inside a process-substitution

From: helmut . karlowski
Subject: redirection inside a process-substitution
Date: Mon, 22 Aug 2016 19:38:52 +0000 (UTC)

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 
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?


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?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]