Coprocesses
Coprocesses are a feature of the Korn shell only.
|
|
Coprocess; execute the pipeline in the background. The shell sets up a two-way pipe, allowing redirection of both standard input and standard output. |
|
|
Read coprocess output into variable var. |
|
|
Write string to the coprocess. |
|
|
Take input for cmd from the coprocess. |
|
|
Send output of cmd to the coprocess. |
|
|
Move input from coprocess to file descriptor n. |
|
|
Move output for coprocess to file descriptor n. |
Moving the coprocess input and output file descriptors to standard file descriptors allows you to open multiple coprocesses .
Examples
$ed - memo |&Start coprocess $print -p /word/Send ed command to coprocess $read -p searchRead output of ed command into variable search $print "$search"Show the line on standard output A word to the wise.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access