通过 bash 脚本从“时间"命令获取值 [英] get values from 'time' command via bash script
本文介绍了通过 bash 脚本从“时间"命令获取值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想用 time 命令运行一些可执行文件
I want to run some executables with the time command
time myexec -args
如何仅将时间输出存储到 bash 中的变量?这是我关心这个脚本的唯一部分,而不是可执行文件的输出.有没有办法获得该值,还是我必须解析整个命令的文本?
How can I store only the time output to a variable in bash? Thats the only part I care about for this script, not the output of the executable. Is there a way to get that value, or will I have to parse the text of the entire command?
推荐答案
其实我也发现了这个 - 如何存储时间"输出的子字符串;bash 脚本中的函数
Actually, I found this as well - How to store a substring of the output of "time" function in bash script
可能更接近我想要的
这篇关于通过 bash 脚本从“时间"命令获取值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文