syntax:keywords:coproc

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Last revision Both sides next revision
syntax:keywords:coproc [2013/01/15 02:49]
ormaaj Fixes to the examples, grammar, and spelling. (Someone should review these examples for correctness).
syntax:keywords:coproc [2013/01/15 03:00]
ormaaj Fixes to the examples, grammar, and spelling. (Someone should review these examples for correctness).
Line 12: Line 12:
 Bash 4.0 introduced //​coprocesses//,​ a feature certainly familiar to ksh users. The ''​coproc''​ keyword starts a command as a background job, setting up pipes connected to both its stdin and stdout so that you can interact with it bidirectionally. Optionally, the co-process can have a name ''​NAME''​. If ''​NAME''​ is given, the command that follows **must be a compound command**. If no ''​NAME''​ is given, then the command can be either simple or compound. Bash 4.0 introduced //​coprocesses//,​ a feature certainly familiar to ksh users. The ''​coproc''​ keyword starts a command as a background job, setting up pipes connected to both its stdin and stdout so that you can interact with it bidirectionally. Optionally, the co-process can have a name ''​NAME''​. If ''​NAME''​ is given, the command that follows **must be a compound command**. If no ''​NAME''​ is given, then the command can be either simple or compound.
  
-The process ID of the shell spawned to execute the coprocess is available ​as the value of the variable named by ''​NAME''​ followed by a ''​_PID''​ suffix. For example, the variable name used to store the PID of a coproc with no NAME given would be ''​COPROC_PID''​. [[commands:​builtin:​wait]] may be used to wait for the coprocess to terminate. Additionally,​ coprocesses may be manipulated through their ''​jobspec''​.+The process ID of the shell spawned to execute the coprocess is available ​through ​the value of the variable named by ''​NAME''​ followed by a ''​_PID''​ suffix. For example, the variable name used to store the PID of a coproc ​started ​with no ''​NAME'' ​given would be ''​COPROC_PID'' ​(because ''​COPROC''​ is the default ''​NAME''​). [[commands:​builtin:​wait]] may be used to wait for the coprocess to terminate. Additionally,​ coprocesses may be manipulated through their ''​jobspec''​.
  
 ==== Return status ==== ==== Return status ====
  • syntax/keywords/coproc.txt
  • Last modified: 2013/04/14 12:36
  • by thebonsai