Skip to main content

Questions tagged [coprocesses]

1 vote
1 answer
104 views

coproc redirect to stdout

Suppose I have some process that when ready will output to stdout. Even though I want my script to run asynchronously with respect to that process, I still want the script to block and wait on that ...
Mathias Sven's user avatar
1 vote
1 answer
263 views

Bash coproc with python

I am playing with the coproc of Bash and I am failing to understand something. I started with the following example: Example#1 $ coproc MY_BASH { bash; } [1] 95244 $ echo 'ls -l; echo EOD' >&&...
chemacabeza's user avatar
2 votes
1 answer
7k views

How does bash know about its parent's coprocess in this situation, and why does a shebang line change it?

outer.sh: ls -l /proc/$$/exe coproc cat ./inner.sh kill $! inner.sh: ls -l /proc/$$/exe set | grep COPROC || echo No match found coproc cat kill $! When I run ./outer.sh, this gets printed: ...
Joseph Sible-Reinstate Monica's user avatar
0 votes
1 answer
682 views

Return value vs return status of a coprocess

I don't understand this sentence about Coprocesses in the bash man page: Since the coprocess is created as an asynchronous command, the coproc command always returns success. The return status of a ...
The Quark's user avatar
  • 454
0 votes
0 answers
479 views

zsh, zpty: How to read the output of a process after it has exited?

Start some command with zpty: zpty -d x ; zpty x 'echo hi' ; sleep 1 How do I read its output now that it has exited? zpty -r x Returns 2, and this behavior seems expected per the manpage.
HappyFace's user avatar
  • 1,704
6 votes
2 answers
959 views

coproc and named pipe behaviour under command substitution

I have a requirement to make a function in a zsh shell script, that is called by command substitution, communicate state with subsequent calls to the same command substitution. Something like C's ...
Phil's user avatar
  • 175
0 votes
1 answer
474 views

Using coprocess to write a name referenced variable in BASH

I currently try to start background process with coproc and update a name reference variable. My not working code: function updateVariable(){ local -n myVar="${1}" #i=0; while : do ...
kon's user avatar
  • 123
1 vote
0 answers
53 views

Usage of cvlc with coproc

I'm trying to feed to file descriptor .mp3 files the with the dummy interface of vlc, i.e., cvlc, in order to add to a playlist on the fly or override the entire file descriptor with new data (new ....
amosmoses's user avatar
1 vote
1 answer
1k views

Coproc in bash script

I'm trying to do a simple shell script that will make my raspberry's bluetooth discoverable but i'm facing some issues. My raspberry is running Raspbian. Running this through command line works ...
Kamigaku's user avatar
7 votes
2 answers
2k views

Is it possible to have multiple concurrent coprocesses?

The intent of the test script1 below is to start an "outer" coprocess (running seq 3), read from this coprocess in a while-loop, and for each line read, print a line identifying the current iteration ...
kjo's user avatar
  • 16.4k
10 votes
4 answers
6k views

Run command in background with foreground terminal access

I am trying to create a function that can run an arbitrary command, interact with the child process (specifics omitted), and then wait for it to exit. If successful, typing run <command> will ...
John Kugelman's user avatar
1 vote
1 answer
531 views

How does bash coprocess achieve its pipelining?

Note this passage from man bash ( emphasis mine ): Coprocesses A coprocess is a shell command preceded by the coproc reserved word. A coprocess is executed asynchronously in a subshell, as if ...
Sergiy Kolodyazhnyy's user avatar
5 votes
2 answers
3k views

Is coproc <command> the same as <command> &? [duplicate]

I have read that $coproc < command > is different from $< command > & in that coproc will execute command in a sub-shell process. But when I tested it, it worked just like $< ...
Tran Triet's user avatar
-3 votes
2 answers
538 views

inter process comunication in bash read commands in multiple background functions

I'm trying to get the following code to read from a main input then read that in one function then be able to send that into the input of another function but i am having trouble getting it to work ...
Clark Kent's user avatar
3 votes
1 answer
444 views

Why does this gawk coprocess hang?

While having a go at Convert date in bash shell, I tried GNU awk's coprocess feature: gawk -F, -v cmd='date +"%Y-%m-%d %H:%M:%S" -f-' '{print $5 |& cmd; cmd |& getline d; $5 = d}1' foo This ...
muru's user avatar
  • 77.9k

15 30 50 per page