How to redirect stderr and stdout to different files in the same line in script?

后端 未结 5 1673
既然无缘
既然无缘 2020-11-30 17:51

I know this much:

$ command 2>> error

$ command 1>> output

Is there any way I can output the stderr to the error file and outp

5条回答
  •  没有蜡笔的小新
    2020-11-30 18:44

    Just add them in one line command 2>> error 1>> output

    However, note that >> is for appending if the file already has data. Whereas, > will overwrite any existing data in the file.

    So, command 2> error 1> output if you do not want to append.

    Just for completion's sake, you can write 1> as just > since the default file descriptor is the output. so 1> and > is the same thing.

    So, command 2> error 1> output becomes, command 2> error > output

提交回复
热议问题