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