<分区>
我使用 travis-ci 从头开始构建 linux 7.8 版。在构建期间,travis-ci 抛出错误,因为日志文件大于 4 兆字节。你可以在lfs-auto, build #15看到
现在,我想将所有数据从 stdout 重定向到/dev/null 以减少日志文件的大小。通常,人们将每个命令的重定向操作用作 dev/null。但是这样会使 shell 脚本变得太长且难以阅读
有没有人有解决这些问题的想法?
问题解决了!感谢大家有意见
我选择解决方案 exec >/dev/null 因为该命令将 all 输出从 std 重定向到/dev/null 而无需其他操作。在这种情况下,exec >/dev/null 比 script-file >/dev/null 或 { command, ... } 简单,易于编辑>/dev/null
解决问题重复
加上一些评论,这个问题的内容与How do I redirect the output of an entire shell script within the script itself?相同和 how to redirect output of multiple commands to one file
我知道我的问题与 How do I redirect the output of an entire shell script within the script itself? 相同,但我的问题更清楚,更短
我需要更多评论来解决两种情况下的重复问题
- 将此问题与其他问题合并并删除此问题
- 删除这个问题什么都不做
- 什么都不做