Linux 判斷文件修改時(shí)間和系統(tǒng)時(shí)間差
#!/bin/bashtimestamp=`date +%s`filepath=/root/yuhui/ta-2016030307.logif [ -f $filepath ];thenecho "文件存在!路徑為:$filepath"filetimestamp=`stat -c %Y $filepath`echo "文件最后修改時(shí)間戳:$filetimestamp"timecha=$[$timestamp - $filetimestamp] if [ $timecha -gt 60 ];then echo '當(dāng)前時(shí)間大于文件最后修改時(shí)間60秒' else echo '當(dāng)前時(shí)間小于文件最后修改時(shí)間60秒' fielseecho "文件不存在或者您輸入的路徑有誤"fi
感謝閱讀,希望能幫助到大家,謝謝大家對(duì)本站的支持!
新聞熱點(diǎn)
疑難解答
圖片精選