开发者

Very strange redirecting stdout and stderr issues can someone explain them?

I have two calls that produce very different output:

Call one:

dmake -m _makefile_.m  1>> _results.out 2>> _results.out

Call two:

dmake -m _makefile_.m >2&1 >_results.out

dmake does a compile of sorts and the first call correctly inlines compile errors whereas the second one puts all the compile errors at the top. I was always of the opinion that both of these were equivalent. What exactly are the differences between these two calls? Is this because of bu开发者_运维问答ffering?


>2&1 is not the right syntax; it will redirect the output of the dmake command to a file called 2 (running it in background), then attempt to run a command called 1 with its output redirected to _results.out.

You want:

dmake -m _makefile_.m >_results.out 2>&1

Change > to >> if you want to append to the file.

I'm not 100% sure whether this will intersperse stdout and stderr the way you want.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜