Background process redirect to COPROC
问题 In the following test script I run an elementary coprocess to which the echo built-in, run in background, attaches its standard-output: #!/bin/bash # TEST 1 coproc /bin/sleep 100 echo >&${COPROC[1]} & The script always fails, for no apparent reason, giving the output: ./test.sh: line 4: ${COPROC[1]}: Bad file descriptor I wonder if the correct syntax should be rather this one (ampersand moved before redirection): #!/bin/bash # TEST 2 coproc /bin/sleep 100 echo & >&${COPROC[1]} This second