码迷,mamicode.com
首页 > 其他好文 > 详细

脚本基本函数

时间:2020-07-05 18:56:18      阅读:52      评论:0      收藏:0      [点我收藏+]

标签:echo   函数   int   for   %s   star   class   +=   end   

运行时间定义:

starttime=`date +%s -d 2010-01-01 17:23:40`
endtime=`date +%s -d 2010-01-01 15:01:47`
time=`echo $(($endtime - $starttime)) | awk {t=split("60 s 60 m 24 h 999 d",a);for(n=1;n<t;n+=2){if($1==0)break;s=$1%a[n]a[n+1]s;$1=int($1/a[n])}print s}`
echo $time

 

脚本基本函数

标签:echo   函数   int   for   %s   star   class   +=   end   

原文地址:https://www.cnblogs.com/xiaoyuxixi/p/13247061.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!