#!/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.
#!/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.
转载于:https://www.cnblogs.com/LuckWJL/p/10138406.html