What is the process order of redirection and process substitution? One line command to process pre error works Ok.
{ echo hello;jiji jio; } 2> >(while read line;do echo "____$line";done) >right.log
While this order does not.
{ echo hello;jiji jio; } >right.log 2> >(while read line;do echo "____$line";done)
In the above, it is like
jiji jio 2>&1 | while read line;do echo "____$line";done
andecho hello >right.log
.In the second, it is like
{ echo hello; jiji jio 2>&1 | while read line;do echo "____$line";done } >right.log
. Remember thatecho "____$line"
portion triggers it to be redirected to>right.log
(because it writes to stdout).So yes, order does matter. In the second case
>right.log
redirection is remembered when processing2> >(...)
and whenever...
writes to stdout it is redirected to>right.log
.