shell 取得上个月的开始结束日期
2015-11-12 13:15
543 查看
#!/bin/bash if [ $# -eq 1 ]; then day=$1 else day=`date +%Y%m%d` fi tmp_day_dis=$(date +%e -d "${day}") day_dis=$(expr $tmp_day_dis - 1) end_last_month=`date +%Y%m%d -d "-${tmp_day_dis} day ${day}"` last_month=`date +%Y%m%d -d "-1 month ${day}"` start_last_month=`date +%Y%m%d -d "-${day_dis} day ${last_month}"` echo $end_last_month echo $start_last_month
相关文章推荐
- Go2Shell默认打开ITerm2或x-term
- xshell桥接linux
- linux shell — 8.linux 磁盘与文件系统管理(2)
- Linux Shell编程入门
- How to Operate SharePoint User Alerts with PowerShell
- shell 批量获取host
- linux Bash Shell的操作环境
- linux——Shell的控制结构(附shell编写代码和运行结果)
- Linux终端bash美化教程
- HDFS一 HDFS的shell操作
- linux shell 获取当前正在执行脚本的绝对路径
- shell中的条件表达式
- linux shell — 7.linux 磁盘与文件系统管理
- shell脚本:一键安装LAMP、LNMP脚本
- shell脚本:一键安装LAMP、LNMP脚本
- shell here document 应用实例--shell控制数据库
- linux shell 的here document 用法 (cat << EOF)
- SVN 多项目配置 (shell 一键配置)
- shell点滴
- linux shell 中文件编码查看及转换方法