【问题标题】:How to not lose information from UNIX command line如何不丢失 UNIX 命令行中的信息
【发布时间】:2018-06-08 01:32:07
【问题描述】:

对于大型脚本,输出太长而无法放入 unix 命令行。有没有办法不丢失信息并在命令行中一次性查看所有信息?

【问题讨论】:

标签: unix command-line


【解决方案1】:

您可以通过管道发送到tee,并将其保存到文件中:

npm audit fix | tee -a output.txt

-a 标志表示追加,因此它不会覆盖 output.txt 中的任何其他内容。如果你想覆盖它,请忽略-a

例子:

[I] sean at goz in ~/d/save
> ruby -v | tee -a output.txt
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]
[I] sean at goz in ~/d/save
> cat output.txt
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]
[I] sean at goz in ~/d/save
> echo yes | tee -a output.txt
yes
[I] sean at goz in ~/d/save
> cat output.txt
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]
yes
[I] sean at goz in ~/d/save
>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-11-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-12-31
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多