co-processes

Other topics

Hello World

# create the co-process
coproc bash

# send a command to it (echo a)
echo 'echo Hello World' >&"${COPROC[1]}"

# read a line from its output
read line <&"${COPROC[0]}"

# show the line
echo "$line"

The output is "Hello World".

Contributors

Topic Id: 6933

Example Ids: 23435

This site is not affiliated with any of the contributors.