[英]Why time command in linux has different output when I type it in shell than I use it in script?
The problem is when I use time in shell I get output like that: 问题是,当我在shell中使用时间时,我得到如下输出:
1.350u 0.038s 0:01.45 95.1% 0+0k 0+72io 1pf+0w
And when Im using it in script I get: 当我在脚本中使用它时,我得到:
real 0m1.253s
user 0m1.143s
sys 0m0.047s
I mean why? 我的意思是为什么 And in shell script at the beginning I write:
在开头的shell脚本中我写道:
#!/bin/bash
Bash has a built-in command time
, and your system should also have a separate binary at /usr/bin/time
: Bash有一个内置的命令
time
,你的系统也应该在/usr/bin/time
有一个单独的二进制文件:
$ help time time: time [-p] pipeline Report time consumed by pipeline's execution. Execute PIPELINE and print a summary of the real time, user CPU time, ... $ which time /usr/bin/time
The two commands produce different outputs: 这两个命令产生不同的输出:
$ time echo hi hi real 0m0.000s user 0m0.000s sys 0m0.000s $ /usr/bin/time echo hi hi 0.00user 0.00system 0:00.00elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k 0inputs+0outputs (0major+199minor)pagefaults 0swaps
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.