SkillAgentSearch skills...

Coproc.bash

Missing parallel routines (coprocesses) in bash

Install / Use

/learn @reconquest/Coproc.bash
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

coproc.bash travis

Go-routines in bash.

demo.gif

Importing

Using import.bash

import:use github.com/reconquest/coproc

Reference

See reference at REFERENCE.md.

Usage

Creating coprocess

coproc:run bc_proc "bc"

Communicating with coprocess

Setting up file descriptors

coproc:get-stdin-fd "$bc_proc" stdin

coproc:get-stdout-fd "$bc_proc" stdout
coproc:get-stderr-fd "$bc_proc" stderr

Send line

echo "1+1" >&$stdin

Receive line

read -u $stdout result

Sending initial stdin

Also, stdin can be passed on creating coprocess:

coproc:run bc_proc "bc" <<< "1+4"

coproc:get-stdout-only "$bc_proc"  # will output 5
View on GitHub
GitHub Stars21
CategoryDevelopment
Updated5mo ago
Forks3

Languages

Shell

Security Score

72/100

Audited on Oct 17, 2025

No findings