Shell 脚本计算时间差
starttime=`date +'%Y-%m-%d %H:%M:%S'` #执行程序 sleep 10 endtime=`date +'%Y-%m-%d %H:%M:%S'` echo $starttime $endtime start_seconds=$(date --date="$starttime" +%s); end_seconds=$(date --date="$endtime" +%s); echo "本次运行时间: "$((end_seconds-start_seconds))"s"
浙公网安备 33010602011771号