Linux中bash计算程序耗时

Linux中bash计算程序耗时

制作人:全心全意

Linux中bash计算程序耗时

starttime=`date +'%Y-%m-%d %H:%M:%S'`
#执行程序
endtime=`date +'%Y-%m-%d %H:%M:%S'`
start_seconds=$(date --date="$starttime" +%s);
end_seconds=$(date --date="$endtime" +%s);
echo "本次运行时间: "$((end_seconds-start_seconds))"s"

  

引用:https://www.cnblogs.com/leixingzhi7/p/6281675.html

posted @ 2021-01-07 09:26  全心全意_运维  阅读(381)  评论(0编辑  收藏  举报