#!/bin/bash
#获取当前时间戳,单位是秒
now=`date +%s`
#拿秒参与计算
last=`expr $now + 3600`
#生成文件名字
filename="xxx.log.`date -d @$last +%Y-%m-%d-%H`"
echo `grep abc $filename` >> 1.log
#!/bin/bash
#获取当前时间戳,单位是秒
now=`date +%s`
#拿秒参与计算
last=`expr $now + 3600`
#生成文件名字
filename="xxx.log.`date -d @$last +%Y-%m-%d-%H`"
echo `grep abc $filename` >> 1.log
本文标题:shell date 时间戳使用
本文链接:https://www.haomeiwen.com/subject/wdraghtx.html
网友评论