美文网首页
shell date 时间戳使用

shell date 时间戳使用

作者: 科英 | 来源:发表于2020-05-07 16:04 被阅读0次
#!/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