Shell脚本,比较源文件修改时间与系统时间
需要用到一个Shell脚本,用于对比文件修改时间与现行时间的差值,默认300秒,5分钟
#!/bin/bash
timestamp=$(date +%s)
filetimestamp=$(stat -c %Y filename)
#echo $timestamp
#echo $filetimestamp
#echo $[$timestamp - $filetimestamp]
if [ $[$timestamp - $filetimestamp] -lt 300 ];
then
command
else
command
fi - 上一篇: 关于车辆年检新规小知识
- 下一篇: Linux下安装teamspeak3并启动它