zsh-users
 help / color / mirror / code / Atom feed
* Bi-directional pipe
@ 2006-06-07 12:50 Guillaume Chazarain
  2006-06-07 14:56 ` Peter Stephenson
  2006-06-09  3:28 ` Bart Schaefer
  0 siblings, 2 replies; 9+ messages in thread
From: Guillaume Chazarain @ 2006-06-07 12:50 UTC (permalink / raw)
  To: zsh-users

Hi,

Is there a way to make a bi-directional pipe in zsh?
That is, something like: foo | bar doing implicitly bar | foo, so
foo stdin <- bar stdout and
foo stdout <- bar stdin

Here is an example of what I want to do:

#!/bin/zsh

mkfifo fifo
exec 4>&1
(
exec 0<fifo
rm fifo
RES=0
while [ "$RES" -lt 10 ]; do
    echo "$RES+1"
    read RES
    echo "$RES" >&4
done
) | bc -q > fifo


The script enclosed between parenthesis writes and read to/from bc.
This approach uses a FIFO, so I would have hoped for a solution to
avoid needing a writable part of the filesystem ;-)

Maybe there is a magic incantation I can substitute to the | in order to
have a bi-directional pipe, or some function to create a pipe that I would
redirect to.

Thanks in advance for any help.

-- 
Guillaume


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2006-06-11 19:24 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-07 12:50 Bi-directional pipe Guillaume Chazarain
2006-06-07 14:56 ` Peter Stephenson
2006-06-07 15:41   ` Guillaume Chazarain
2006-06-09  3:28 ` Bart Schaefer
2006-06-09  9:06   ` Guillaume Chazarain
2006-06-09  9:51     ` Bart Schaefer
2006-06-11 15:06       ` Vincent Lefevre
2006-06-11 19:24         ` Bart Schaefer
2006-06-09  9:33   ` Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).