I stumbled across something that (not only to me) looks like a problem[*]...
(ksh 93t+ 2010-03-05)
In the subsequent construct the first expression was not yet finished (file
out2 not yet
written) but the next statement p4 (which expected out2 to be available)
already executed.
p1 | tee >( p3 | p2 >out2 ) >( p2 >out1 )
#sleep 1
p4
(By activating the 'sleep' I could work around the issue; but this is a hack
that will
produce other race conditions and, I suspect, may not work with larger sizes of
date.)
It seems that 'p3 | p2 >out' is asynchronously executed in ksh. I have two
questions...
1) Why has the process substitution been implemented that way? In the Usenet
discussion
it had been pointed out that the asynchronous behaviour could be simply
realized by
p1 | tee >( p3 | p2 >out2 & ) >( p2 >out1 )
i.e. adding an '&'. And, the other way round, as it is currently implemented
it seems
impossible to achieve the synchronous beheviour in any way.
2) Using the Kornshell, is there any safe work-around possible to be sure that
all the
processes in the above pipeline/process substitution construct will have
finished
before the next command (p4) will be invoked?
Note: The described ksh behaviour seems to be equivalent to the bash behaviour,
but the
behaviour of zsh is different, zsh behaves as I'd expect it.
Thanks.
--
[*] I had posted my question in Usenet (comp.unix.shell)
https://groups.google.com/group/comp.unix.shell/browse_thread/thread/d64cbd9b90904256
and someone pointed me to another earlier discussion from last year
https://groups.google.com/forum/?fromgroups=#!topic/comp.unix.shell/GqLNzUA4ulA
_______________________________________________
ast-users mailing list
[email protected]
http://lists.research.att.com/mailman/listinfo/ast-users