一个简单统计时间间隔的shell脚本Demo
2015-12-22 12:56
711 查看
#!/bin/bash begin_time=$(date "+%s") echo -e "begin_time = $begin_time" sleep 3 end_time=$(date "+%s") echo -e "end_time = $end_time" time_distance=$(($end_time - $begin_time)); hour_distance=$(expr ${time_distance} / 3600) hour_remainder=$(expr ${time_distance} % 3600) min_distance=$(expr ${hour_remainder} / 60) min_remainder=$(expr ${hour_remainder} % 60) echo -e "spend time is ${hour_distance}:${min_distance}:${min_remainder}"
相关文章推荐
- shell中seq运用
- 【笔记】Linux shell脚本编程
- 小shell函数
- shell 截取日志 统计链接数 统计日志ip
- Win10 RS1预览版11082无法打开PowerShell没反应的解决办法
- xshell putty等终端,如何记录终端输入输出
- C程序调用shell脚本共有三种方法
- shell文本过滤编程(九):sed命令
- shell文本过滤编程(七):awk之变量传递
- shell文本过滤编程(八):awk之内置函数
- shell内置命令集合
- 今天领导分享了一个探测端口的命令-linux下提示bash:command not found
- AD回收站
- CRLF line terminators导致shell脚本报错:command not found
- 在XShell中使用sz和rz命令下载和上传文件
- CentOS 7.0之配置静态ip XShell连接
- SharePoint 2013 使用 PowerShell 更新用户
- Xshell启动时显示丢失MSVCP110.dll解决方法
- shell脚本学习(三)
- 右键git bash here和git gui here失效恢复