Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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 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). –  Peter Horvath Feb 18 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 at 14:42
    
Perl also exists everywhere. And you can see, that also bash isn't really uniform everywhere. –  Peter Horvath Feb 18 at 14:44
1  
-bash: perl: command not found –  Dog eat cat world Feb 18 at 14:46
1  
You have right, I am really sorry. –  Peter Horvath Feb 18 at 14:47

1 Answer 1

up vote 3 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.