获取sh脚本运行时间

 1 #!/bin/bash
 2 
 3 
 4 start=`date +'%Y-%m-%d %H:%M:%S'`
 5 
 6 #执行程序
 7 
 8 end=`date +'%Y-%m-%d %H:%M:%S'`
 9 start_seconds=$(date --date="$start" +%s);
10 end_seconds=$(date --date="$end" +%s);
11 echo "本次运行时间: "$((end_seconds-start_seconds))"s"

 

posted @ 2020-11-18 15:36  IIIID  阅读(816)  评论(0编辑  收藏  举报