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"
勤苦修行得自在,道力有边边亦无边!