Linux 中 如何将time命令输出的时间信息保存在文件中
001、 通常做法
[root@localhost test]# time seq 10 > a.txt 2> xxx ## 完全追加至xxx real 0m0.002s user 0m0.000s sys 0m0.002s [root@localhost test]# ls a.txt xxx [root@localhost test]# cat a.txt 1 2 3 4 5 6 7 8 9 10 [root@localhost test]# cat xxx ## 无内容
002、正确做法
[root@localhost test]# ls [root@localhost test]# time (seq 10 > a.txt) 2> xxx ## time作用命令用括号括起来,后边在重定向 [root@localhost test]# ls a.txt xxx [root@localhost test]# cat a.txt 1 2 3 4 5 6 7 8 9 10 [root@localhost test]# cat xxx real 0m0.001s user 0m0.000s sys 0m0.001s
。
下边也可以:
。
分类:
linux shell
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律
2023-01-27 西数硬盘颜色
2021-01-27 bash: javac: command not found...