如何从“时间"命令中获取实时值? [英] How do I get just real time value from 'time' command?
本文介绍了如何从“时间"命令中获取实时值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想制作一个仅从time命令输出实时值的脚本,以便我可以绘制结果.例如time command
输出
I would like to make a script that outputs only the real time value from the time command so I can plot the results. For example time command
outputs
real 1m0.001s
user 1m0.000s
sys 0m0.001s
我想写一个输出脚本
60.001
如何在几秒钟内从时间"命令中获取实时值?
How do I get just real time value from 'time' command in seconds?
推荐答案
如果您正在使用内置的Bash time
,请将TIMEFORMAT
变量设置为%R
:
If you're using the Bash builtin time
, set the TIMEFORMAT
variable to %R
:
$ TIMEFORMAT=%R
$ time sleep 1
1.022
这篇关于如何从“时间"命令中获取实时值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文