How to redirect and append both stdout and stderr to a file with Bash?

前端 未结 7 1185
春和景丽
春和景丽 2020-11-22 01:16

To redirect stdout to a truncated file in Bash, I know to use:

cmd > file.txt

To redirect stdout in Bash, appending to

7条回答
  •  闹比i
    闹比i (楼主)
    2020-11-22 01:39

    In Bash you can also explicitly specify your redirects to different files:

    cmd >log.out 2>log_error.out
    

    Appending would be:

    cmd >>log.out 2>>log_error.out
    

提交回复
热议问题