将两个标准输出通过管道传输到标准输入的基础知识
说到管道,我有点陌生。我想要做的(在 Windows PC 上,但我猜它与 UNIX 相同)是这样的:
(output.exe "second part" & output.exe "first part") | someapp.exe -
我被告知我
无法多次写入标准输出
一个类似的 unix 示例可能是:
(echo -n part2 & echo -n part1) | md5
它执行我想要的操作(原则上)。
从表面上看,是“output.exe”应用程序发出了警告(如果在没有 | someapp.exe - 的情况下运行,则输出仍然存在)。要么这只是运气不好,要么我错过了一些我不理解的管道的关键基础知识。
output.exe 给出的输出可以被 someapp.exe 附加和理解。有没有办法让两个output.exe一次输出一个到stdout?
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 times
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
奇怪,我的windows7下好像可以用。我编写了几个测试程序,一切都如您所期望的那样工作
所以也许问题实际上出在您的output.exe或someapp.exe程序中?我在 Win7 和 WinXP 上进行了测试 我的程序在这里: http://min.us/mvphIUz
注意: &似乎在 Windows 中看起来像 ;在unix中。即分隔顺序运行的命令。如果您使用 &在 UNIX 中,它们都会同时运行,并且输出会很混乱。
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
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.