开发者

Why does ditto send errors to stdout and output to stderr?

Maybe I'm missing something, but when I type do a verbose ditto command (ditto [-v] [-V] 2>>some.log), it will send regular output to stderr. Therefore, my some.log file will be filled with entries like copying file ....

This doesn't make logical sense to me, but it's what the manual says as well:

-V            Print a line of output to stderr for every file, symbolic
              link, and device copied.

I haven't verified this, but I assume that actual I/O errors are sent to stdout. My original want was to display regu开发者_如何转开发lar output, but log all errors. So assuming that errors are sent to stdout, then this problem isn't really much of a problem - it's just that the semantics don't make sense to me.

So, this should give me the correct outputs:

ditto -V /some/path/ /some/other/path 1>>some.log


Actually, ditto sends both error messages and verbose status messages to stderr. The reason is that if it's in -c (create archive) mode, and the destination file was specified as -, it writes the archive to stdout. Having status messages mixed in with the archive would be very very bad. BTW, tar -v does the same thing, for the same reason.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜