写了一个linux的计时脚本,能够输出时分秒

news/2024/7/3 3:48:26
#!/bin/bashstart=$(date +%s)# 用需要计时的程序将下面这句替换掉
sleep 100;end=$(date +%s)
take=$(( end - start ))
echo Time taken to execute commands is ${take} seconds.let min=${take}/60
let left1=${take}-$(( ${min} * 60 ))echo That is ${min} minutes and ${left1} seconds.let h=${take}/3600
let left2=${min}-$(( ${h} * 60 ))echo That is ${h} hours and ${left2} minutes.

输出

 里面用到了两种linux下的四则运算 let 以及 ${{}} 

参考blog shell(7):四则运算


http://lihuaxi.xjx100.cn/news/240543.html

相关文章

gulp

详情请参见github: https://github.com/Sunnshino/gulpjs-plugs 1 /*2 目录结构:3 test(主目录)4 src(输入路径)5 index.html(主页面)6 js(文件夹)7 less(文件夹)8 images(文件夹)9 …

图的连通性和连通分量_英语,人口,连通性和露营地

图的连通性和连通分量by Evaristo Caraballo通过Evaristo Caraballo 英语,人口,连通性和露营地 (English, Population, Connectivity and Campsites) 在世界范围内推动使用Free Code Camp的因素 (Factors driving the use of Free Code Camp worldwide)…

aligned_storage简单学习

#include <iostream> #include <type_traits> #include <string>/* template< std::size_t Len, std::size_t Align default-alignment >struct::type aligned_storage; 相当于一个内建的POD类型他的大小是Size他的对齐方式是Align */ template<c…

gitlab安装各种坑

架构&#xff1a;源码安装, 数据库用mysql,网站用nginx 坑一.nginx报错 122016/07/19 09:26:11 [crit] 3881#0: *10 connect() to unix:/home/git/gitlab/tmp/sockets/gitlab-workhorse.socket failed (13: Permission denied) while connecting to upstream, client: 192.168.…

1.6 INSERT语句

1.6 INSERT语句正在更新内容&#xff0c;请稍后

把握机缘_机缘巧合,蒙太奇训练以及我的朋友如何使自己失业

把握机缘by Wiley Jones通过威利琼斯 机缘巧合&#xff0c;蒙太奇训练以及我的朋友如何使自己失业 (Serendipity, training montages, and how my friend automated himself out of a job) “No one person’s Hollywood success story has anything in common with anybody e…

form表单的action提交写到js中来,同时onclick事件也写在js中来。其action也可以通过ajax来提交的。...

假如你现在还在为自己的技术担忧&#xff0c;假如你现在想提升自己的工资&#xff0c;假如你想在职场上获得更多的话语权&#xff0c;假如你想顺利的度过35岁这个魔咒&#xff0c;假如你想体验BAT的工作环境&#xff0c;那么现在请我们一起开启提升技术之旅吧&#xff0c;详情请…

51单片机编码自学_这是9个月的自学式编码看起来像什么

51单片机编码自学by Stephen Mayeux斯蒂芬马约(Stephen Mayeux) 这是9个月的自学式编码看起来像什么 (Here’s What 9 Months of Self-Taught Coding Looks Like) 只是划伤表面 (Just Scratching the Surface) Today marks 9 months since I embarked on my journey as a self…