
1、datesh代码
#!/bin/sh
beg_date=`date -d "$1" +%s`
end_date=`date -d "$2" +%s`
if [[ -z $1 ]]||[[ -z $2 ]];then
echo "Usage: $0 YYYYMMDD YYYYMMDD"
exit 0;
fi
if [[ ${beg_date} > ${end_date} ]];then
echo "The end_date < beg_date ;Please input the right date,example: $0 20140101 20140301"
exit 0;
fi
for (( i=${beg_date};i<=${end_date};i=i+86400))
do
date -d @${i} +%Y%m%d
done
2、实例/datesh 20140101 20140201
1,$HOME/getdatesh,内容如下:
#!/bin/bash
DATE=/bin/date
$DATE +"%F %T" >>$HOME/date_loglog
2 $HOME/call_gdsh,内容如下
#!/bin/bash
SH=/bin/sh
${SH} $HOME/getdatesh
以上就是关于linux shell 获取是一个时间段的日期全部的内容,包括:linux shell 获取是一个时间段的日期、Shell脚本获取系统时间 Linux程序、等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)