1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-23 17:02:08 +02:00
tldr/pages.nl/linux/coproc.md
Sebastiaan Speck 444c78c805
coproc: add Dutch translation (#13366)
coproc:  Dutch translation
2024-08-13 00:31:34 +02:00

32 lines
1.1 KiB
Markdown

# coproc
> Bash ingebouwd commando voor het maken van interactieve asynchrone subshells.
> Meer informatie: <https://www.gnu.org/software/bash/manual/bash.html#Coprocesses>.
- Voer een subshell asynchroon uit:
`coproc { {{commando1; commando2; ...}}; }`
- Maak een coprocess met een specifieke naam:
`coproc {{naam}} { {{commando1; commando2; ...}}; }`
- Schrijf naar de `stdin` van een specifiek coprocess:
`echo "{{invoer}}" >&"${{{naam}}[1]}"`
- Lees van de `stdout` van een specifiek coprocess:
`read {{variabele}} <&"${{{naam}}[0]}"`
- Maak een coprocess dat herhaaldelijk `stdin` leest en opdrachten op de invoer uitvoert:
`coproc {{naam}} { while read line; do {{commando1; commando2; ...}}; done }`
- Maak een coprocess dat herhaaldelijk `stdin` leest, een pipeline uitvoert op de invoer, en de uitvoer naar `stdout` schrijft:
`coproc {{naam}} { while read line; do echo "$line" | {{commando1 | commando2 | ...}} | cat /dev/fd/0; done }`
- Maak en gebruik een coprocess dat `bc` uitvoert:
`coproc BC { bc --mathlib; }; echo "1/3" >&"${BC[1]}"; read output <&"${BC[0]}"; echo "$output"`