Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have some scripts which use coproc to control stdout/stdin of subprocesses. Unfortunately, coproc was introduced in Bash 4.0, and on many systems I use, there is an earlier versions of bash.

Are there any alternatives to coproc?

share|improve this question

closed as off-topic by MadHatter, Rex, Falcon Momot, Katherine Villyard, Ward Feb 21 '14 at 16:43

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions seeking product, service, or learning material recommendations are off-topic because they tend to become obsolete quickly. Instead, describe your situation and the specific problem you're trying to solve." – MadHatter, Rex, Ward
If this question can be reworded to fit the rules in the help center, please edit the question.

Bash has a lot more severe, unexplained limitations as well. I think, you are on the point when you should leave it and use some other (maybe perl or python were good choices in your place). – peterh Feb 18 '14 at 14:39
@PeterHorvath, that is true, but bash is the only "language" which is common for all platforms. I try to write my script for the common denominator rather than maintaining different versions of it. – Dog eat cat world Feb 18 '14 at 14:42
Perl also exists everywhere. And you can see, that also bash isn't really uniform everywhere. – peterh Feb 18 '14 at 14:44
-bash: perl: command not found – Dog eat cat world Feb 18 '14 at 14:46
You have right, I am really sorry. – peterh Feb 18 '14 at 14:47
up vote 4 down vote accepted

You can used standard named pipe instead of coproc:

mkfifo in_data out_data

command <in_data >out_data &

exec 3> in_data 4< out_data

echo <some thing here> >&3
read <some variables here> <&4
share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.