记录脚本运行时间

#!/bin/bash 
start=$(date +%s) # 1528437613
ping -c 10 baidu.com &> /dev/null 
end=$(date +%s) 
difference=$(( end - start )) 
echo $difference seconds.

运行后会输出脚本的运行时间

[root@localhost ~]# bash test.sh 
10 seconds.

 

posted @ 2018-12-18 17:06  Chuyio  阅读(719)  评论(0编辑  收藏  举报