开发者

fundamentals of piping two stdout to stdin

I'm a bit green when it comes to piping. What I'm trying to do (on a Windows PC, but I'd guess it's the same as for UNIX) is this:

(output.exe "second part" & output.exe "first part") | someapp.exe -

I'm told that I

can't write to stdout multiple tim开发者_运维问答es

A similar unix example could be:

(echo -n part2 & echo -n part1) | md5

which does what I want (in principle).

From the looks of it it's the "output.exe" app which gives the warning (if run without | someapp.exe -, the output remains). Either this is just bad luck, or I'm missing some key fundamental of piping which I don't understand.

the output which output.exe gives can be appended and understood as such by someapp.exe just fine. Is there some way to have the two output.exe output to stdout one at a time?


Strange, looks like it works for me on windows7. I whacked up a couple of test programs and it all worked as you'd expect

C:\tmp>( output.exe part1 & output.exe part2 ) | input.exe
LINE[0]: ARG[0]: output.exe
LINE[1]: ARG[1]: part1
LINE[2]: ARG[0]: output.exe
LINE[3]: ARG[1]: part2

So maybe the problem is actually in your output.exe or someapp.exe programs? I tested on both Win7 and WinXP My programs are here: http://min.us/mvphIUz

NOTE: That the & seems in windows appears to work like the ; in unix. That is delimits the commands that are run sequentually. If you used & in unix they would all be run concurrently and the output would be jumbled.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜