Skip to main content
deleted 224 characters in body
Source Link

This solution uses a named pipe. Shells compatible with Bourne's should have no problem with it.

fifo=${TMPDIR-/tmp}/$(basename "$0")-$$-foo-bar
trap 'rm -f "$fifo"' EXIT
mkfifo -m u=rw,go= "$fifo" || exit

foo > $fifo &
bar < $fifo 

wait $! || exit
trap - EXIT
rm -f "$fifo"

Even simpler:

fifo=${TMPDIR-/tmp}/$(basename "$0")-$$-foo-bar
mkfifo -m u=rw,go= "$fifo" || exit

foo > $fifo &
bar < $fifo 
rm -f "$fifo"

wait $! || exit

This solution uses a named pipe. Shells compatible with Bourne's should have no problem with it.

fifo=${TMPDIR-/tmp}/$(basename "$0")-$$-foo-bar
trap 'rm -f "$fifo"' EXIT
mkfifo -m u=rw,go= "$fifo" || exit

foo > $fifo &
bar < $fifo 

wait $! || exit
trap - EXIT
rm -f "$fifo"

Even simpler:

fifo=${TMPDIR-/tmp}/$(basename "$0")-$$-foo-bar
mkfifo -m u=rw,go= "$fifo" || exit

foo > $fifo &
bar < $fifo 
rm -f "$fifo"

wait $! || exit

This solution uses a named pipe. Shells compatible with Bourne's should have no problem with it.

fifo=${TMPDIR-/tmp}/$(basename "$0")-$$-foo-bar
mkfifo -m u=rw,go= "$fifo" || exit

foo > $fifo &
bar < $fifo 
rm -f "$fifo"

wait $!
Source Link

This solution uses a named pipe. Shells compatible with Bourne's should have no problem with it.

fifo=${TMPDIR-/tmp}/$(basename "$0")-$$-foo-bar
trap 'rm -f "$fifo"' EXIT
mkfifo -m u=rw,go= "$fifo" || exit

foo > $fifo &
bar < $fifo 

wait $! || exit
trap - EXIT
rm -f "$fifo"

Even simpler:

fifo=${TMPDIR-/tmp}/$(basename "$0")-$$-foo-bar
mkfifo -m u=rw,go= "$fifo" || exit

foo > $fifo &
bar < $fifo 
rm -f "$fifo"

wait $! || exit