Michael Haubenwallner
2016-04-12 08:51:32 UTC
Hi,
I'm encountering problems with some multi-processing bash script
that boils down to:
$ bash -c '
rm -f /tmp/testpipe.$$
trap "rm -f /tmp/testpipe.$$" EXIT
mkfifo /tmp/testpipe.$$
exec {fw}<>/tmp/testpipe.$$
exec {fr}<>/tmp/testpipe.$$
for x in {1..10}
do
(
trap "echo job $x pid \$BASHPID status \$? done >& $fw" EXIT
exit $x
) &
done
for z in {1..10}
do
read -u $fr
echo $REPLY
done
wait
'
Agreed, POSIX does not define behaviour for using '<>' with fifos,
but it works with AIX, *BSD, HP-UX, Interix, Linux, Solaris, ...
Thoughts?
/haubi/
I'm encountering problems with some multi-processing bash script
that boils down to:
$ bash -c '
rm -f /tmp/testpipe.$$
trap "rm -f /tmp/testpipe.$$" EXIT
mkfifo /tmp/testpipe.$$
exec {fw}<>/tmp/testpipe.$$
exec {fr}<>/tmp/testpipe.$$
for x in {1..10}
do
(
trap "echo job $x pid \$BASHPID status \$? done >& $fw" EXIT
exit $x
) &
done
for z in {1..10}
do
read -u $fr
echo $REPLY
done
wait
'
Agreed, POSIX does not define behaviour for using '<>' with fifos,
but it works with AIX, *BSD, HP-UX, Interix, Linux, Solaris, ...
Thoughts?
/haubi/