#!/bin/sh
timer_start=`date "+%Y-%m-%d %H:%M:%S"`
echo "开始时间:$timer_start"
#测试,睡眠3秒
sleep 3s
timer_end=`date "+%Y-%m-%d %H:%M:%S"`
echo "结束时间:$timer_end"
start_seconds=$(date --date="$timer_start" +%s);
end_seconds=$(date --date="$timer_end" +%s);
echo "本次运行时间:"$((end_seconds-start_seconds)) "秒"