linux 中记录程序运行的时间

 

001、

[root@pc1 test1]# start=$(date +%s)       ## 记录程序的开始时间
[root@pc1 test1]# echo $start
1671529118
[root@pc1 test1]# end=$(date +%s)         ## 记录程序的结束时间
[root@pc1 test1]# echo $end
1671529132
[root@pc1 test1]# let elapse=end-start    ## 记录程序的消耗时间 
[root@pc1 test1]# echo $elapse
14

 

posted @ 2022-12-20 09:41  小鲨鱼2018  阅读(175)  评论(0编辑  收藏  举报