sh command: exec 2>&1

后端 未结 6 685
名媛妹妹
名媛妹妹 2020-12-24 00:45

What will this command do?

exec 2>&1 
6条回答
  •  再見小時候
    2020-12-24 01:13

    It ties standard error to standard out

    the 2 is stderr and 1 is stdout. When you run a program, you'll get the normal output in stdout, but any errors or warnings usually go to stderr. If you want to pipe all output to a file for example, it's useful to first combine stderr with stdout with 2>&1.

提交回复
热议问题