shell脚本计算执行时间
#!/bin/bash startTime=`date +%Y%m%d-%H:%M:%S` startTime_s=`date +%s` sleep 15 endTime=`date +%Y%m%d-%H:%M:%S` endTime_s=`date +%s` sumTime=$[ $endTime_s - $startTime_s ] echo "$startTime ---> $endTime" "Total:$sumTime seconds"
#!/bin/bash startTime=`date +%Y%m%d-%H:%M:%S` startTime_s=`date +%s` sleep 15 endTime=`date +%Y%m%d-%H:%M:%S` endTime_s=`date +%s` sumTime=$[ $endTime_s - $startTime_s ] echo "$startTime ---> $endTime" "Total:$sumTime seconds"