代码如下:
#!/bin/bash
timestamp=$(date +%s)
filetimestamp=$(stat -c %Y filename)
#echo $timestamp
#echo $filetimestamp
#echo $[$timestamp - $filetimestamp]
if [ $[$timestamp - $filetimestamp] -lt 300 ];
then
command
command
...
else
command
command
...
fi