bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Feature Request] more powerful process communication


From: MSB
Subject: [Feature Request] more powerful process communication
Date: Wed, 10 Apr 2002 21:47:20 +0200

I have 2 ideas that would be useful additions to bash IMHO:

a) socketpair instead of pipe

command1 |<>| command 2

Would do the following

create a socketpair
command1 is started with stdout and stdin to the one side and command2 is
started with stdout and stdin to the other side of the socket

This would allow bidirectional communication as opposed to unidirectional
with a pipe. A simple example:

AB=""
{
  AB=${AB}a
  echo $AB
  read AB
  sleep 1
}
|s|
{
  read AB
  AB=${AB}b
  echo $AB
  sleep 1
}


b) more flexible pipe creation

command1  x|>>y  command2

creates a pipe whose input end has file descriptor x in the context of
command1 and whose output end has file descriptor y in the context of
command2.

The standard pipe | would be equivalent to 1|>0

More than 1 such construct could be used together. 

command1 |<>| command2   could be simulated like this:

command1  1|>>0 0<<|1  command2

This feature would allow for very powerful co-processes.

MSB
-- 
God is real, unless declared integer.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]