通过bash脚本得到'时间'命令值 [英] get values from 'time' command via bash script

查看:173
本文介绍了通过bash脚本得到'时间'命令值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要运行一些可执行文件用时命令

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?

推荐答案

其实,我发现这个问题,以及 - <一个href=\"http://stackoverflow.com/questions/4457953/how-to-store-a-substring-of-the-output-of-time-function-in-bash-script\">How保存时间功能的bash脚本输出的一个子

Actually, i found this as well - How to store a substring of the output of "time" function in bash script

大概接近我一直在寻找

这篇关于通过bash脚本得到'时间'命令值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆