Saturday, July 26, 2014

Bash IPC made easy with coproc

Source: http://unix.stackexchange.com/questions/86270/how-do-you-use-the-command-coproc-in-bash
$ coproc awk '{print $1 $2 $3;fflush();}'
$ echo one two three >&${COPROC[1]}
$ read -ru ${COPROC[0]} var1 var2 var3
$ echo "$var1 $var2 $var3"
one two three
$ kill $COPROC_PID 

No comments:

Post a Comment