diff options
Diffstat (limited to 'tests/coproc.tests')
-rw-r--r-- | tests/coproc.tests | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/coproc.tests b/tests/coproc.tests new file mode 100644 index 0000000..8be3563 --- /dev/null +++ b/tests/coproc.tests @@ -0,0 +1,45 @@ +coproc { echo a b c; sleep 2; } + +echo $COPROC_PID +echo ${COPROC[@]} + +read LINE <&${COPROC[0]} +echo $LINE + +wait $COPROC_PID + +coproc REFLECT { cat - ; } + +echo $REFLECT_PID +echo ${REFLECT[@]} + +echo flop >&${REFLECT[1]} +read LINE <&${REFLECT[0]} + +echo $LINE + +kill $REFLECT_PID +wait $REFLECT_PID + +coproc xcase -n -u + +echo $COPROC_PID +echo ${COPROC[@]} + +echo foo >&${COPROC[1]} +read <&${COPROC[0]} + +echo $REPLY +echo ${COPROC[@]} + +cat /etc/passwd | grep root | awk -F: '{print $1;}' | sed 1q + +exec 4<&${COPROC[0]}- +exec >&${COPROC[1]}- + +echo ${COPROC[@]} + +read foo <&4 +echo $foo >&2 + +exit 0 |