Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous 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/04/14 12:36] (current)
thebonsai Don't tread version 4 special - it has been around for a long time now
Line 1: Line 1:
 ====== The coproc keyword ====== ====== The coproc keyword ======
-:V4: 
  
 ===== Synopsis ===== ===== Synopsis =====
Line 12: Line 11:
 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.1358218168.txt
  • Last modified: 2013/01/15 02:49
  • by ormaaj