sh command: exec 2>&1

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

What will this command do?

exec 2>&1 
6条回答
  •  爱一瞬间的悲伤
    2020-12-24 01:26

    Like @cma said, it puts stderr on stdout. The reason you might want this behavior is to use grep or any other utility to capture output that only appears on stderr. Or you might just want to save all the output, including stderr, to a file for later processing.

提交回复
热议问题