shell脚本对代码执行时间的计时


 

时间秒: $(date +%s)

算数表达式:

$(($cost_time/60))

$(($cost_time%60))

#!/bin/bash

# ccache is from epel mirrors:http://mirrors.xxxx.com.cn/epel/7Server/x86_64/
start_time=$(date +%s)
sleep 1

#sudo mock -r xxxx-v5.05-x86_64 --rebuild kernel-3.10.0-957.1.3.el7.xxxx.gd2389d1.src.rpm --no-clean --no-cleanup-after

end_time=$(date +%s)
cost_time=$[ $end_time-$start_time ]
echo "build kernel time is $(($cost_time/60))min $(($cost_time%60))s"

  


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM