将stdout和stderr恢复为默认值

问题描述 投票:8回答:2

在shell脚本中,我们可以使用exec命令将默认输入更改为文件,如下所示:

  exec 1>outputfile

但是,如果要在同一脚本中将标准输出描述符'1'恢复为默认值(终端)。我们如何实现这一目标?

linux shell redirect exec stdout
2个回答
8
投票

此示例


0
投票

尝试使用“ tee”命令:

© www.soinside.com 2019 - 2024. All rights reserved.