bug-bash
[Top][All Lists]
Advanced

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

coproc does not work in subshell


From: Hyunho Cho
Subject: coproc does not work in subshell
Date: Fri, 2 Oct 2020 20:59:34 +0900

Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -g -O2
-fdebug-prefix-map=/build/bash-a6qmCk/bash-5.0=.
-fstack-protector-strong -Wformat -Werror=format-security -Wall
-Wno-parentheses -Wno-format-security
uname output: Linux EliteBook 5.4.0-42-generic #46-Ubuntu SMP Fri Jul
10 00:24:02 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu

Bash Version: 5.0
Patch Level: 17
Release Status: release

####################################################################

bash$ coproc  while read -r line; do eval expr "$line"; done
[1] 172053

bash$ echo "1 + 2" >& ${COPROC[1]}; read -r <& ${COPROC[0]}; echo
$REPLY                      # OK
3

bash$ echo $( echo "1 + 3" >& ${COPROC[1]}; read -r <& ${COPROC[0]};
echo $REPLY )       # command substitution : OK
4

bash$ cat <( echo "1 + 4" >& ${COPROC[1]}; read -r <& ${COPROC[0]};
echo $REPLY )          # process substitution : OK
5

bash$ ( echo "1 + 5" >& ${COPROC[1]}; read -r <& ${COPROC[0]}; echo
$REPLY )                  # ERROR : subshell does not work
bash: ${COPROC[1]}: Bad file descriptor
bash: ${COPROC[0]}: Bad file descriptor
3



reply via email to

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